What is servlet context ?
Servlet context defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file. A servlet context object is one per web application per JVM and this object is shared by all the servlet. You can get and set the Servlet context object. You can use servelt context object in your program by calling directly getServletContext() or getServletConfig().getServletContext().Reply
What is servlet mapping?
Servlet mapping controls how you access a servlet. Servlet mapping specifies the web container of which java servlet should be invoked for a url given by client. For this purpose web container uses the Deployment Decriptor (web.xml) file. Servlets are registered and configured as a part of a Web Application. To register a servlet, you add several entries to the Web Application deployment descriptor.
Servlet Mapping :
A developer can map all the servelts inside its web application.Reply
What mechanisms are used by a Servlet Container to maintain session information?
The mechanisms used by a Servlet Container to maintain session information :
b) URL rewriting
c) Hidden form fields
d) SSL (using HTTPS protocol) SessionsReply
What are the different ways for session tracking?
The concept of session tracking allows you to maintain the relation between the two successive request from the same client (browser). The browser sends the request to the server and server process the browser request generate the response and send back response to the browser. The server is not at all bothered about who is asking for the pages. The server (because of the use of HTTP as the underlying protocol) has no idea that these 2 successive requests have come from the same user. There is no connection between 2 successive requests on the Internet.
There are three ways of tracking sessions :
* Using Cookies.
* Using URL Rewriting.
* Using Hidden Form Fields.
What is difference between custom JSP tags and beans?
JSP has its own tag library that you can use in any nuber of pages. You can also create your own tags (Cusustom tags), define attributes and body of the tags and then group your tags into collections called tag library.
To use custom JSP tags, you need to define three separate components:
* Tag handler class.
* Tag library descriptor file.
* JSP file that uses the tag library.
When the first two components are done, you can use the tag by using taglib directive.
JavaBeans are Java utility classes you defined. Beans have a standard format for Java classes. Custom tags and beans accomplish the same goals � encapsulating complex behavior into simple and accessible forms.
Difference between custom JSP tags and beans :
* Custom tags require more work to set up than do beans.
* Custom tags can manipulate JSP content, beans cannot.
* Custom tags usually define relatively self-contained behavior, whereas beans are often defined in one servlet and used in a different servlet or JSP page.Reply
What is the difference between JSP and Servlets ?
JSP(Java Server Pages) and Servlets, both are server side executed program and used to generate dynamic web page. Servlets are pure java classes and compiled directly into the .class whereas JSP page is a combination of HTML and java code. First of all JSP is translated into java file and then compiled into servlet. Functionally both are same. Both use the Servlet API to communicate with the web server and the client. Both require a container on the server, such as Tomcat, which provides the environment and VM for the Java program. Servlets are best suited for request processing, handling the business logic while JSP is suitable for content generating (client view). It is easy to include HTML tag in JSP rather than servlet.Reply
What is lifecycle of JSP?
Life cycle of JSP :
* JSP page translation,
* JSP page compilation,
* load class,
* create instance,
* call the jspInit() method,
* call the _jspService() method, and
* call the jspDestroy() method. Reply
What is JSP?
JSP is a Java technology provides support to generate dynamic page using HTML, XML tag and scriptlets written in the Java programming language. JSP provides us a way to write Java code embedded into the HTML. JSP pages separate the page logic from its design and display.
JSP pages are compiled into servlets and may call JavaBeans components or Enterprise JavaBeans components to perform processing on the server.
JavaServer Pages has two subcategories :
* Tag Libraries
* JavaServer Pages Standard Tag Library(JSTL).
what are cookies?
A Cookie is a small piece of information or messages used to communicate between the web server and the web browser. Your browser stores each message in a small file, called cookie.txt. This information is exchanged between the browser and the server to remember some specific information.
Examples of cookies :
* Cookies are used to track web site activity.
* Cookies are also used for online shopping.
Cookie Security : The easiest way to secure yourself against the supposed dangers of cookies is to get one of the latest browser versions and turn cookies off.Reply
What is difference between jdk1.4 and jdk1.5?
Following is added into jdk1.5 .which was not into jdk1.5:
Java Language Features
Enhanced for Loop
Class Data Sharing
Garbage Collector Ergonomics
Server-Class Machine Detection
Thread Priority Changes
Fatal Error Handling
High-Precision Timing Support
So many other new features has been added.Reply