Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What can I do with the pageContext EL implicit object

 
JohnWilliam Fitz
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I have just met the EL implicit object named "pageContext". Unlike all the other EL implicit objects, it is a bean, not a map, and an instance of a PageContext object so it would seem.

I am trying to find something useful I can do with it in EL, but I can find nothing. Yes, I can output it's full name with ${pageContext}. But that's not much fun.

And, yes, as a bean it has a whole bunch of getXxx methods. But none of those return a string, map, list or bean that I can play with in EL.

So, I wonder to myself, what useful use is there for this EL implicit object? Does anyone have an example? Is it coming up in a later chapter perhaps?

John
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But none of those return a string, map, list or bean that I can play with in EL.

For example, ${pageContext.request.locale.language}. Look at the API and find the getters. You're saying that none of the getters returns a bean (what are you calling a bean ?), but they all return something, don't they ? getRequest() returns a ServletRequest. From there, you look at the the getters in ServletRequest, so that you can figure out what you can use.
 
Victor Dolirio
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As you know, this api was designed to give you access to other objects that aren�t directly acessible by the other implicit objects(maps) of the EL like request, response and others. Often I use this api to access some properties of the request, like server address, contextPath, local address and so... If you research this apis you can find a lot of useful methods...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic