-
Is Servlets thread-safe?
Service() method of servlet class is not synchronize then how will it work as thread-safe for every request at the same time?
-
Can I invoke a JSP error page from a servlet?
Yes, you can invoke the JSP error page and pass the exception object to it from within a servlet. The trick is to create a request dispatcher for the JSP error page, and pass the exception object as a javax.servlet.jsp.jspException request attribute. However, note that you can do this from only within controller servlets.If your servlet opens an OutputStream or PrintWriter, the JSP engine will throw...
-
What is the servlet life cycle?
Each servlet has the same life cycle:A server loads and initializes the servlet (init())The servlet handles zero or more client requests (service())The server removes the servlet (destroy()) (some servers do this step only when they shut down)
-
-
-
-
-
-
-
-
-
Can I just abort processing a JSP?
Yes. Because your JSP is just a servlet method, you can just put (whereever necessary) a < % return; % >
-
What information that the ServletResponse interface gives the servlet methods for replying to the client?
It Allows the servlet to set the content length and MIME type of the reply. Provides an output stream, ServletOutputStream and a Writer through which the servlet can send the reply data.
-
-
-
-
How to get one Servlet's Context Information in another Servlet?
Access or load the Servlet from the Servlet Context and access the Context Information
-
-
-
Servlets Interview Questions
Ans