• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

storing objects in pageContext

 
varun prakash
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per my understanding calling pageContext.setAttribute(key,object) stores the object in page scope.My question is whether it is stored inside pageContext.Means like implicit Object, requestScope and applicationScope,pageContext is also a map.(or)pageContext is just a way to store the objects inside any of the scopes.

Are Objects with page scope stored in the PageContext(implicit object)???
 
Kaveriappa Poonacha
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Varun,
the inheritance tree for PageContext:
java.lang.Object
extended by javax.servlet.jsp.JspContext
extended by javax.servlet.jsp.PageContext
Please refer the excellent JSP API Javadocs.
Hope this answers your question.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kaveriappa MP
Welcome to JavaRanch!

We're pleased to have you here with us in the FORUM_NAME forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here
 
varun prakash
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
I want to reframe my question a little bit.

Attributes stored in request scope are stored in Implicit object requestScope(map).Similarly where pageScope attributes are stored?

Since PageContext is not an object,page Scope attributes cannot be stored in pageContext.Am i correct?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since PageContext is not an object,page Scope attributes cannot be stored in pageContext.Am i correct?


I suggest that you read the javadocs for javax.servlet.jsp.PageContext - an abstract Class.

There is a nice discussion of all of the facilities that a PageContext supplies.
Bill
 
Stefan Evans
Bartender
Posts: 1782
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The request object stores its attributes in some way.
The pageContext object stores its attributes in some way.

How these objects store their attributes is irrelevant to you.
They could be stored in a map (and probably are) but they don't have to be.
The implicit objects revealed to EL as Maps: pageScope, requestScope, sessionScope etc etc are seperate.

So you have two implicit variables.
pageContext - for accessing the pageContext object
pageScope - for accessing the attributes stored in the pageContext. It gets them by calling pageContext.getAttribute()

Does that clear things up?
 
varun prakash
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all for the reply
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic