aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes about implicit JSP objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "about implicit JSP objects " Watch "about implicit JSP objects " New topic
Author

about implicit JSP objects

Timber Lee
Ranch Hand

Joined: Oct 14, 2002
Posts: 157
Which of the following implicit JSP objects have page scope?
A request
B response
C config
D pageconfig


SCJP<br />SCWCD<br />SCEA
Marcelo Sousa Ancelmo
Ranch Hand

Joined: Jan 17, 2002
Posts: 497

request - request scope > false
response - page scope > true
config - page scope > true
pageconfig - there is no pageconfig implicit object > false
So right answers are B and C


Marcelo Sousa Ancelmo - Brazil
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Am I the only one who has problems understanding questions such as this, and the precise concept of "scope" in this context? The problem is not a lack of knowledge about the internals of servlets and JSPs -- I know perfectly well what each of these objects do -- but about semantics: what does "scope" mean exactly?
For JavaBeans, "scope" is well defined. A bean is generally either a ServletContext attribute, a ServletRequest attribute, or a PageContext attribute. Implicit objects are less straightforward though.
Like the "request" object, the "response" is with us for the entire duration of the request, so arguably it has request scope. The specification says "page scope", though, so page scope it is.
The request (like the response) may be hidden behind wrappers for part of its lifetime; does that affect its "scope-ness" in this question? Clearly not not. The spec says it's request scope.
Apparently the determining factor for "scope-ness" is where we can find the implicit object in question. The response is page scope because we can find it in the PageContext object. But wait a minute, we can find the request there as well! And there is no "getRequest()" method anywhere else! But Sun obviously decided that "request" being page scope would be nonsensical. To be honest, you can make a very good case that "response" being considered page scope is just as nonsensical.
So I'm reduced to merely learning by rote how the specification defines the scope, without that adding anything to my actual knowledge or helping me in any way to do my job
Can anyone make more sense of this?
- Peter
Frosty One
Greenhorn

Joined: Nov 07, 2002
Posts: 5
I have taken several of the practice tests in the Manning SCWCD and the one topic I have had difficulty getting a grasp on is the concept of JSP scopes and how they relate to the implicit variables and Objects. It seems to make sense : application=ServletContext is Application scope, session=HttpSession is session scope, request=ServletRequest is request scope; I think page scope is the confusing one. Any simple rules to live by for page scope?
Marcelo Sousa Ancelmo
Ranch Hand

Joined: Jan 17, 2002
Posts: 497

Yourself responded your question, you said that:
application=ServletContext is Application scope, session=HttpSession is session scope, request=ServletRequest is request scope

So, anything different from this is page scope, i.e: response, out, config, page, pageContext and exception.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: about implicit JSP objects