about implicit JSP objects
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Which of the following implicit JSP objects have page scope?
A request
B response
C config
D pageconfig
A request
B response
C config
D pageconfig
SCJP<br />SCWCD<br />SCEA
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
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
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
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
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
posted 22 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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?
posted 22 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Yourself responded your question, you said that:
So, anything different from this is page scope, i.e: response, out, config, page, pageContext and exception.
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.
Marcelo Sousa Ancelmo - Brazil
| There is no "i" in denial. Tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |







