Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Page Context attributes

 
Jahnavi Kondapaneni
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jahnavi Kondapaneni
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell me if there are any other advantages of using PageContext?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same thing with EL.

Btw also classic tags use the PageContext.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic