What is the difference between HttpServlet and GenericServlet? |
A GenericServlet has a service() method aimed to handle requests. |
Post/View Answer
Post comment
Cancel
Thanks for your comment.!
Write a comment(Click here) ...
|
Explain the life cycle methods of a Servlet? |
The javax.servlet.Servlet interface defines the three methods known as life-cycle method.
|
What is the difference between the getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface and javax.servlet.ServletContext interface? |
The getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface accepts parameter the path to the resource to be included or forwarded to, which can be relative to the request of the calling servlet. If the path begins with a "/" it is interpreted as relative to the current context root. |
Explain the directory structure of a web application?. |
The directory structure of a web application consists of two parts. |
What are the common mechanisms used for session tracking? |
Cookies |
Explain ServletContex?. |
ServletContext interface is a window for a servlet to view it's environment. A servlet can use this interface to get information such as initialization parameters for the web application or servlet container's version. Every web application has one and only one ServletContext and is accessible to all active resource of that application. |
What is preinitialization of a servlet? |
A container doesnot initialize the servlets as soon as it starts up, it initializes a servlet when it receives a request for that servlet first time. This is called lazy loading. The servlet specification defines the |
|
What is the difference between Difference between doGet() and doPost()? |
A doGet() method is limited with 2k of data to be sent, and doPost() method doesn't have this limitation. A request string for doGet() looks like the following: |
What is the difference between ServletContext and ServletConfig? |
ServletContext: 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.The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized. ServletConfig: The object created after a servlet is instantiated and its default constructor is read. It is created to pass initialization information to the servlet. |