How do you create a webpage using apache tomcat?
Apache`s Tomcat is an integrated web server. It si used for hoisting web sites with support for servlets, jsps and other server-side technologies. It IS NOT USED for CREATING websites. Make a web-page using html(you may use tools like dreamweaver or outlook for the design). Have a jsp script supporting the server side computations and run on apache webserver and feel the magic..
All access is relative to the local time zone of the server, so you simply record the local time. Knowing the server's time zone allows you determine how many hours behind or in front of UTC you are and knowing the user's time zone allows you to do the same for the user, thus you can calculate the time difference by subtracting one from the other.
For example, suppose the server is in Los Angeles, USA and the user is in Rome, Italy. Los Angeles is UTC -8 while Rome is UTC +1, so the time difference is 9 hours in total, such that Rome is 9 hours ahead of Los Angeles. So if a user accesses the server at 10:00 Los Angeles time, it would have been 19:00 in Rome.
As another example, suppose the server is in Helsinki, Finland (UTC +2), and the user is in Toronto, Canada (UTC -5). The time difference is 7 hours, such that Toronto is 7 hours behind Helsinki. So an access at 10:00 in Helsinki occurred at 03:00 in Toronto.
Which browser is best for HTML and PHP developers?
PHP will work the same in all modern browsers, since it is a server-side script (meaning the code is executed on the server, rather than the user's computer).
HTML is slightly different as it is executed on the user's machine by the browser, and some browsers handle HTML differently. Some slightly older (and very old) browsers don't understand some HTML tags at all!
So in the case for HTML, the latest version of Chrome or Firefox would be your best option as both of these browsers support many or all HTML5 (the latest version of HTML) tags.
They also have developer tools so you can inspect your client-side code (HTML, JS, CSS, but not PHP) which might help you find out why something has gone wrong.
However, when developing don't forget that your audience might not be using the latest browser like you are, so they might get different results when they go onto your website! It's a good idea to have different browsers (and if possible, different versions of those browsers) on your machine to test your code in to make sure you get the same results every time.
What is the relationship between JSP and JDBC?
There is no other relation apart from having Java in their names.
JSP is a technology that is used to create powerful User Interface components
whereas
JDBC is a technology that is used to connect to Relational Databases like Oracle or Sybase
Why do we need a Session?
When one page needs to share information with another, the scope of the data broadens beyond processing a single request. This is because, when a response gets committed, all the data that was held in the request that generated that response is destroyed. So, if you want that data in another page, you will be looking at a blank request object with no data in it. When such a need arises, you must send the data from one page to the server and from the server to the next requested page, whether it be the same page or another page altogether. There are several ways to share state information between requests. However, the primary or the easiest way is to use sessions.
How Do Sessions Work?
The container generates a session ID. When you create a session, the server saves the session ID on the client's machine as a cookie. If cookies are turned off then it appends the ID in the URL. On the server, whatever you add to the session object gets placed in server memory-very resource intensive. The server associates that object in memory with the session ID. When the user sends a new request, the session ID is sent too. The server can then match the objects in its memory with that session ID. This is how we maintain client state.
File Upload into Database in JSP?
<%@page language="java" session="true"
import="java.io.*,java.util.*,java.io.*,java.sql.*,javax.servlet.*"%>
<%
//to get the content type information from JSP Request Header
String contentType = request.getContentType();
if (contentType != null && contentType.indexOf("multipart/form-data") >= 0)
{
DataInputStream in = new DataInputStream(request.getInputStream());
//we are taking the length of Content type data
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
//this loop converting the uploaded file into byte code
while (totalBytesRead < formDataLength)
{
byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
totalBytesRead += byteRead;
}
String file = new String(dataBytes);
//for saving the file name
String saveFile = file.substring(file.indexOf("filename="") + 10);
saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
saveFile = saveFile.substring(saveFile.lastIndexOf("") + 1,saveFile.indexOf("""));
int lastIndex = contentType.lastIndexOf("=");
String boundary = contentType.substring(lastIndex + 1);
int pos;
//extracting the index of file
pos = file.indexOf("filename="");
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
int boundaryLocation = file.indexOf(boundary, pos) - 4;
int startPos = file.substring(0, pos).getBytes().length;
int endPos = file.substring(0, boundaryLocation).getBytes().length;
// creating a new file with the same name and writing the content in new file
//FileOutputStream fileOut = new FileOutputStream(saveFile);
FileOutputStream fileOut = new FileOutputStream("C:\\Program Files\\Apache Software Foundation\\Tomcat 5.0\\webapps\\incidentreportform_main\\upload"+saveFile+"");
fileOut.write(dataBytes, startPos, (endPos - startPos));
fileOut.flush();
fileOut.close();
//out.println(saveFile);
Connection con=null,con1=null;
Statement stmt=null,stmt1=null;
PreparedStatement ps=null,ps1=null;
ResultSet rs=null,rs1=null;
String sql="",sql1="",a="";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:inficert","inficert","inficert");
stmt=con.createStatement();
String sno=request.getParameter("parameter");
int j1=0;
try
{
sql="UPDATE department set crftitle =('"+saveFile+"') where sno='"+sno+"'";
j1=stmt.executeUpdate(sql);
if(j1!=0)
{
%>
<script type="text/javascript">
alert('Successfully Uploaded');
top.location.href = "selectlocation.jsp";
</script>
<%
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
%>
How do you get bean data using jsp display tag?
The jsp:useBean Tag
Whenever we want to include business logic and data in a JSP page, JavaBeans are the best way to do it. And to let us accomplish this we use the jsp:useBean tag.
When you use jsp:useBean, the container performs several actions. Basically, it instantiates the object in memory and provides a variable name for you to use within the scope you set in the tag. If the bean class hasn't been loaded, the container will try to locate it and load it. The container creates the bean and stores it as an attribute of the scope object. The value of the id attribute determines the name of the bean within the object scope. Using this name, you can access this bean inside your JSP.
The typical syntax of useBean usage is:
typeSpec ::= class="className" |
class="className" type="typeName" |
type="typeName" class="className" |
beanName="beanName" type="typeName" |
type="typeName" beanName="beanName" |
type="typeName"
The id and scope are easy. The confusion always comes up about the usage of the typeSpec. The container will always look for the Bean. However, if the typeSpec is used one way, the container will throw an exception if it can't find that Bean (not already instantiated). If it is used another way, it will create a new instance of the Bean if one hasn't been created already.
What is the difference between script and scriptlet?
"script" is an HTML tag used to include JavaScript on a web page.
Example:
<HTML>
<body>
<script type="text/javascript">
document.write("hi there"); // javascript interpreted by the browser
</script>
</body>
</HTML>
"Scriptlet" is a JSP construct used to include Java in a JSP page.
Example:
<HTML>
<body>
<% // this is a scriptlet
response.getWriter().write("hi there"); // Java executed on the server
%>
</body>
</HTML>
Here the result (an HTML document with the text "hi there") is the same in both cases, but the mechanisms are different - Javascript runs in the browser (any browser), while the JSP scriptlet is executed on the server and needs a server with JSP support.
See related links.
What is the difference of jdk in between java 2 SE and java NewEdition?
First of all, it's "JDK", not "jdk", and "Java", not "java".
What do you mean by "Java new edition"? I do not find that term when I Google for it.
"Java 2 SE" is a brand name for very old, obsolete versions of Java, between version 1.2 and 1.4, inclusive.
The current version of "Java SE" (Java Standard Edition), as it is now called, is version 7, with support still available for version 6. These versions are also called 1.7 and 1.6, respectively.
See <http://www.oracle.com/technetwork/java/javase/jdk7-naming-418744.html>
What makes utensils microwvave safe?
Microwave safe simply means that the material that the "utensil" or cookware is made of does not readily react to the bombardment of microwaves and many microwaves can pass through them more unobscured than with other materials. Their structures may get warm as they are excited but do not melt, spark or release their composits into food/air etc... For example metals will spark as the microwaves hit their surface, certain glasses and ceramics will get hot as their molecules build up energy from the microwaves radiating through them until they let loose and crack or explode.
What is the output of a XSLT processor?
The output of an XSLT processor is a set of instructions that dictate how to display the XML data.
How do you hack a Maplestory private server sql database to make me a gm?
doing so would mean hacking into the server host's computer which is illegal although you probably already knew that.
How can I say java based applications are secure?
All Java Based Apps are secure because Java is one of the most secure programming languages. For Ex: In Web applications, security can be implemented using strong authentication. The different types of Authentication used in Web Applications are:
• HTTP Basic Authentication - Authentication based on a username and password. It is the authentication mechanism defined in the HTTP/1.0 specification. A Web server requests a Web client to authenticate the user. The Web client obtains the username and the password from the user and transmits them to the Web server. The Web server then authenticates the user. This is the lowest level security of the four here.
• HTTP Digest Authentication - The password is encrypted. Like HTTP Basic Authentication, HTTP Digest Authentication authenticates a user based on a username and a password. However, the authentication is performed by transmitting the password in an encrypted form.
• HTTPS Client Authentication - This is end user authentication using HTTPS (HTTP over SSL). This mechanism uses public key encryption, which requires the user to possess a Public Key Certificate (PKC). This is the highest level security of the four here.
• Form Based Authentication - This is similar to Basic except that a form is used with predefined fields. These fields must be named j_username and j_password, respectively and the form method and action must be named POST and j_security_check, respectively
Field indexing is a form of indexing that makes unique identification of documents possible and retrieval easier. They may identify documents by their creation date, time, and creator, as well as by fields involving a controlled vocabulary.
Can you get source code to slide images with effects?
Yes you can make images to slide with effects. The sliding simple can be made with <marquee> and effects can be done by CSS.
It means that, there was some problem in the Web server and it prevented it from satisfying the request it received. Usually it happens when the server crashes or when there is a database issue etc.
Importance of deployment descriptor in servlet?
The deployment descriptor is an xml file that contains the basic and most important information that is required to deploy a web application (Servlet)
Without this, the web server would not know, which requests to entertain/consider as requests to access this servlet.
FastCGI is an interface that makes programs run on servers run faster. It's intended as an improvement to the older Common Gateway Interface (CGI.) CGI was and is used by servers to call external programs. The problem was that every CGI request created a single process on the machine. This meant that sharing things like memory and database connections (which are hard to create and therefore slower to start new) wasn't possible.
The new FastCGI interface allows a single process to deal with multiple requests to the server. This means that any given process might go on for a very long time, and handle multiple requests. This longevity allows FastCGI to reuse memory allotments, database connections, and other "expensive" tools without always having to create a new one.