Question 3) Sun Certified Web Component

Posted on
Like what you see? Share it.Share on Google+Share on LinkedInShare on FacebookShare on RedditTweet about this on TwitterEmail this to someone

Objective: The Web Container Model
SubObjective : * For the fundamental servlet attribute scopes (request, session, and context): write servlet code to add, retrieve, and remove attributes; given a usage scenario, identify the proper scope for an attribute; and identify multi-threading issues associated with each scope.
Single Answer Multiple Choice

You are developing a Web application in which you are required to access an object by using EL that displays the number of visitors for the application. Which option should you use to access the object?

 

 

  1. You are visitor number: ${requestScope.count}
  2. You are visitor number:${pageScope.count}
  3. You are visitor number:${sessionScope.count}
  4. You are visitor number:${applicationScope.count}

 

 

 

Answer:
D. You are visitor number:${applicationScope.count}

Tutorial:
You should use You are visitor number: ${applicationScope.count}. The applicationScope implicit object provides reference to the application context. The applicationScope.count implicit variable accesses the object count and displays the value of count to the user. You can also access the value of count by using the syntax ${applicationScope[‘count’]}.

 

The option that uses the requestScope implicit object is incorrect because the applicationScope implicit object is used to access objects in the application context. The requestScope implicit object is used to access the objects that are available in the request.

 

The option that uses the pageScope implicit object is incorrect because the applicationScope implicit object is used to access the objects in the application context. The pageScope implicit object is used to access the objects that are available in the page.

 

The option that uses the sessionScope implicit object is incorrect because the applicationScope implicit object is used to access the objects in the application context. The sessionScope implicit object is used to access the objects that are available in the session.

 

Reference:
1. The J2EE 1.4 Tutorial, Chapter 12: JavaServer Pages Technology, Expression Language, Implicit Objects, http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html#wp71043

 

These questions are derived from the Self-Test Software Practice Test for 310-081 – Sun Certified Web Component Developer for J2EE Platform 1.4 .

Like what you see? Share it.Share on Google+Share on LinkedInShare on FacebookShare on RedditTweet about this on TwitterEmail this to someone
cmadmin

ABOUT THE AUTHOR

Posted in Archive|

Comment: