Term
What is the difference between Generic Servlet and HTTP Servlet? |
|
Definition
The Generic Servlet has no service() method defined while HTTPServlet has a service() method defined. |
|
|
Term
What is the life cycle of a Servlet?
(Hint: 3) |
|
Definition
init(), service(), and destroy(). |
|
|
Term
What is the lifecycle of a JSP?
(Hint: 7) |
|
Definition
Page translation, Compilation, Load, Instantiate, init(), service(), and destroy(). |
|
|
Term
How would you preinitialize/preload a servlet? |
|
Definition
Inform the deployment descriptor that you want the Servlet to be auto-initialized with <load-on-startup>. |
|
|
Term
Name some important tags in ServletConfig.
(Hint: 3) |
|
Definition
<init-param> <param-name> <param-value> |
|
|
Term
Name some important tags in ServletContext.
(Hint: 3) |
|
Definition
<context-param> <param-names> <param-value> |
|
|
Term
How would you forward a request from a Servlet to a JSP? |
|
Definition
ResquestDispatcher dispatcher = httpServletRequest.getResquestDispatcher(url);
dispatcher.forward(httpServletRequest, httpServletResponse); |
|
|
Term
What is the difference between ResquestDispatcher.forward() and HttpServletResponse.sendRedirect() in JSP/Servlet? |
|
Definition
- forward() is handled on the server side
(transparent to browser).
- redirect() sends a redirect message to the browser
(client side). |
|
|
Term
In which directory is web.xml located? |
|
Definition
\root\WEB-INF\ or \WebContent\WEB-INF\ |
|
|
Term
|
Definition
JSTL stands for JSP Standard Template Library. |
|
|
Term
What are the various scopes available in JSP?
(Hint: 4) |
|
Definition
Page, Request, Session, and Application. |
|
|
Term
What are the different ways of handling a session in JSP/Servlets?
(Hint: 3) |
|
Definition
Cookies, URL rewriting, and the session object. |
|
|
Term
What is the difference between XML and HTML? |
|
Definition
XML describes the data while HTML displays the data. |
|
|
Term
How would you write a message back to the browser from inside a servlet? |
|
Definition
PrintWriter out = response.getWriter(); // use out.println(“...”) |
|
|
Term
Can you name some of the standard Action Tags in JSP?
(Hint: 6) |
|
Definition
jsp:forward, jsp:include, jsp:plugin. jsp:useBean, jsp:setProperty, jsp:getProperty |
|
|
Term
What is the difference between HTTP GET and HTTP POST? |
|
Definition
GET is for getting (retrieving) data whereas POST may involve anything, like storing or updating data, ordering a product, or sending E-Mail.
Also, GET rewrites the pages URL, POST does not. |
|
|
Term
What is a ServletConfig in JSP/Servlets? |
|
Definition
An object that holds information, defined in the web.xml file, which can be accessed when the servlet is called. |
|
|
Term
What is a ServletContext in JSP/Servlets? |
|
Definition
A global object that is shared within the web application. |
|
|
Term
What are the various types of mark-up tags provided by JSP?
(Hint: 4) |
|
Definition
Directives, Scripting elements (Declarations, Scriplets, Expressions), Comments (JSP, Scripting), and Actions. |
|
|
Term
Can you name some of the implicit objects in JSP?
(Hint: SEACRROPP) |
|
Definition
Session, Exception, Application, Config, Request, Response, Out, Page, PageContext
|
|
|
Term
What do Directives do in JSP? |
|
Definition
They convey special processing information about the page to the JSP container. |
|
|
Term
Name some of the directives in JSP.
(Hint: 3) |
|
Definition
Page, Include, & TagLibrary (taglib) Directives.
|
|
|
Term
What is a static include in JSP? When does it occur? |
|
Definition
The static 'include' is the result of an include directive and occurs during page translation of the JSP life-cycle, forming one servlet.
<%@ include |
|
|
Term
What is a dynamic include in JSP? Where is it located? When does it occur? |
|
Definition
The dynamic 'include' is the result of a standard action tag occurring in the body/service phase of the JSP, and runs as two separate servlets.
<jsp:include page = "footer.jsp" /> |
|
|