File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes About Page Context attributes 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 Page Context attributes" Watch "About Page Context attributes" New topic
Author

About Page Context attributes

Jahnavi Kondapaneni
Ranch Hand

Joined: Jan 25, 2008
Posts: 56
Hi all,

We can set and get the Attributes in SESSION,APPLICATION and REQUEST.I know that there also something called PageContext.
Is it true that using Page Context we can get and set the attributes of SESSION,APPLICATION and REQUEST?
I want to know if my understanding is right?

Thanks in advance
Regards,
Janu
Jan Sterk
Ranch Hand

Joined: Jun 06, 2008
Posts: 139
Yes that's right. PageContext 'has' those 3 objects. So e.g. you can get a Session object from it, and then get the attributes that belong to that Session.

In addition to that, PageContext has the methods getAttribute( String, int ) and findAttribute( String ). Check the API for those.

You can also store attributes to the PageContext itself.


SCJP 1.4 (81%)<br />SCWCD 5 (95%)
Jahnavi Kondapaneni
Ranch Hand

Joined: Jan 25, 2008
Posts: 56
Can you tell me if there are any other advantages of using PageContext?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Hi,

in CustomTags(TagHandler), PageContext is really usefull,using PageContext only you can get request,session,application...

please check CustomTagsAPI in HFJS for in details
Jan Sterk
Ranch Hand

Joined: Jun 06, 2008
Posts: 139
Same thing with EL.

Btw also classic tags use the PageContext.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About Page Context attributes
 
Similar Threads
why config is read only???
What is the Difference B/W Setting attribute in HttptSession and ServletContext?
diff between parameter and attribute
getting session value in JSP
ServletConfig and ServletContext