Sie sind auf Seite 1von 10

1.

Place the events in the order they occur

Ans : 1st ------------> JSP page is translated


2nd ------------> JSP page is compiled
3rd ------------> JSP page implementation class is loaded
4th ------------> JSP page implementation is instantiated
5th ------------> JspInit is called
6th ------------> _jstService is called
7th ------------> 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."

Ans :

< mine-mapping >

< extension > mpg </ extension >


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

< mime-mapping >


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 include
dynamic 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 application
context 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 solution
to configure a servlet context event listener named com.example.MyListener.

Ans :

< listener >

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

< listener >

Das könnte Ihnen auch gefallen