46190503-drag-and-drop-answers

10

Click here to load reader

Upload: biswanath-dutta

Post on 31-Mar-2015

204 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 46190503-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: 46190503-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: 46190503-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: 46190503-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: 46190503-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: 46190503-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: 46190503-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: 46190503-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: 46190503-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: 46190503-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 >