drag and drop answers

12
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

Upload: srinivasan-gopalachari

Post on 01-Dec-2015

148 views

Category:

Documents


0 download

DESCRIPTION

drag and drop for scwcd

TRANSCRIPT

Page 1: Drag and Drop Answers

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

Page 2: Drag and Drop Answers

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’ %>

Page 3: Drag and Drop Answers

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."

Ans :

< mine-mapping >

< extension > mpg </ extension >< mime-type > video/mpeg </ mime-type >

< mime-mapping >

Page 4: Drag and Drop Answers

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’

Page 5: Drag and Drop Answers

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

Page 6: Drag and Drop Answers

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

Page 7: Drag and Drop Answers

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

Page 8: Drag and Drop Answers

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’ />

Page 9: Drag and Drop Answers

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

Page 10: Drag and Drop Answers

10. Place the XML elements in the web application deployment descriptor solutionto configure a servlet context event listener named com.example.MyListener.

Ans :

< listener >

< listener-class > com.example.MyListener </ listener-class >

< listener >

Page 11: Drag and Drop Answers

11.

Page 12: Drag and Drop Answers

Answer for that question is....in the place of "getServletPath" we have to replace it with "/control". in the place of "getPathInfo" we have to replace it with"/processorder" finally in the place of "getContext" we have to replace it with "/myApp"