| Author |
about implicit objects
|
air lulu
Ranch Hand
Joined: Jan 11, 2005
Posts: 42
|
|
question: Which of the following implicit objects can you use to store attributes that need to be accessed from all the sessions of a web application? (Select two) a application b session c request d page e pageContext what is the answer? i think the answer is a,d,e. but the question told that just two. whick answer i chosse is wrong?
|
 |
kapil munjal
Ranch Hand
Joined: May 11, 2004
Posts: 298
|
|
a is correct as it is accessible from everywhere. d is correct as these attributes will be available to all the sessions. e is incorrect as there is no such scope.
|
Kapil Munjal
SCJP 1.4, SCWCD 1.4
|
 |
air lulu
Ranch Hand
Joined: Jan 11, 2005
Posts: 42
|
|
the question is asking "implicit objects ",not scope. pageContext is implicit objects.
|
 |
kapil munjal
Ranch Hand
Joined: May 11, 2004
Posts: 298
|
|
Yes, I was wrong on that... then the answer would be a and e. see this link http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro7.html Well, if this time I am wrong then please tell me how we can use page implicit object to access the attributes.
|
 |
air lulu
Ranch Hand
Joined: Jan 11, 2005
Posts: 42
|
|
how pageContext store attributes that need to be "accessed from all the sessions" of a web application?
|
 |
shiva viswanathan
Ranch Hand
Joined: Aug 12, 2004
Posts: 152
|
|
I think pagerContext is right because using pageContext you can store attributes in the application scope indirectly pageContext.setAttribute("userName","admin",PageContext.APPLICATION_SCOPE) hence even pageContext is a valid answer
|
 |
Sumeet Raheja
Greenhorn
Joined: Dec 01, 2004
Posts: 16
|
|
|
Yes that Right ..Correct Answer is application and pageContext are only implicit object where one can store attribute , which will be availabe from any part of Application
|
 |
Edmund Yong
Ranch Hand
Joined: Nov 16, 2003
Posts: 164
|
|
|
If the web application is distributed on two JVMs, then there will be two different servlet context objects, one on each JVM. Attributes that are set on one servlet context in one JVM may not be propagated to the servlet context in the other JVM. So how can answer (a) be correct?
|
SCJP 1.2, SCWCD 1.4
|
 |
 |
|
|
subject: about implicit objects
|
|
|