| Author |
request vs. pageContext
|
Egil Poma
Ranch Hand
Joined: Nov 23, 2002
Posts: 40
|
|
What's the difference on putting a variable in request (request.setAttribute) vs. putting it in pageContext (pageContext.setAttribute)? Variables in both scopes seems to live only for a single page view. So is there a difference?
|
 |
ramesh kumar
Greenhorn
Joined: Aug 15, 2006
Posts: 25
|
|
|
if we add variables to PageContext we can use them directly,if add them to request object we need to use getAttribute() method to get value
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56529
|
|
Originally posted by ramesh kumar: if we add variables to PageContext we can use them directly
I have no idea what is meant by this. Scoped variables in page scope are accessed in the same manner as in any other scope. The difference is in the scope of the variables (where they can be accessed from) and in their life span. Page-scoped variables are only available in the current page; not included pages, not forwarded pages. Request-scoped variables are available to every resource that participates in the creation of the response. They are most often used to pass data from a servlet controller to its view JSP.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: request vs. pageContext
|
|
|