1. Place the events in the order they occur Ans : 1 st ------------> JSP page is translated 2 nd ------------> JSP page is compiled 3 rd ------------> JSP page implementation class is loaded 4 th ------------> JSP page implementation is instantiated 5 th ------------> JspInit is called 6 th ------------> _jstService is called 7 th ------------> jstDestroy is called
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1. Place the events in the order they occur
Ans : 1st ------------> JSP page is translated2nd ------------> JSP page is compiled3rd ------------> JSP page implementation class is loaded4th ------------> JSP page implementation is instantiated5th ------------> JspInit is called6th ------------> _jstService is called7th ------------> jstDestroy is called
2. Place the code snippets in the proper order to construct the JSP code to import static content into a JSP page at translation-time.
Ans :
<% include file = ‘foo.jsp’ %>
3. Place the appropriate element names on the left on the web application deployment descriptor on the right so that files ending in ".mpg" are associated with the MIME type "video/mpeg."
4. A servlet context listener loads a list of com.example.Product objects from a database and stores that list into the catalog attribute of the ServletContext object.
Place code snippets to construct a jsp:useBean standard action to access this catalog.
Ans :
id = ‘catalog’ type = ‘com.example.product’
scope = ‘application’
5. Place the corresponding resources and directories in the proper web application deployment structure
Ans :
_____ |___JSP files Static content | |___WEB-INF
| |___classes
| |____ java and servlet classes | |____ lib | |____ JAR files | |____ web.xml
6. Place the events in the order they occur.
Ans :
1st ----------> web container loads the servlet class
2nd ----------> web container instantiates the servlet
3rd ----------> web container calls the servlet’s init() Method
4th ----------> web container calls the servlet’s service() Method
5th ----------> web container calls the servlet’s destroy() Method
7. Given a request from mybox.example.com, with an IP address of 10.0.1.11 on port 33086, place the appropriate ServletRequest methods onto their corresponding return values.
Ans :
Mybox.example.com ---------> get RemoteHost
10.0.1.11 ----------> get RemoteHost
33086 ----------> get ServerPort
8. Place the code snippets in the proper order to construct the JSP code to includedynamic content into a JSP page at request-time.
Ans :
< jsp : include page = ‘foo.jsp’ />
9. Place the servlet name onto every request URL, relative to the web applicationcontext root, that will invoke that servlet. Every request URL must be filled.
Ans :
/data/ -----------> DataServlet
/data/index.jsp -----------> DataServlet
/secure/command.do -----------> ControlServlet
/data/command.do -----------> DataServlet
/data.do -----------> ControlServlet
10. Place the XML elements in the web application deployment descriptor solutionto configure a servlet context event listener named com.example.MyListener.