Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL implicit objects properties

 
priya rishi
Ranch Hand
Posts: 119
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

There are 11 implicit objects in EL.
these 11 imp obj have their own properties.
i would like to see the exhaustive list of the properties.
i googled , but didn't find any link.
any one please ..


 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you want to do is check to what object these implicit objects are associated, for instance request maps to HttpServletRequest. Then simply check the API. Whatever is conform to the JavaBean standard will be accessible via EL.
 
prashant k. gupta
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 11 implicit objects in EL:-

1- pageScop ---------- Map of scope attribute
2- requestScope ---------- Map of scope attribute
3- sessionScope ---------- Map of scope attribute
4- applicationScope ---------- Map of scope attribute
5- param ---------- Map of request parameter
6- paramValues ---------- Map of request parameter
7- header ---------- Map of request headers
8- headerValues ---------- Map of request headers
9- cookie ---------- Map of cookie
10- initParam ---------- Map of context init param
11- pageContext ---------- PageContext object



Except pageContext, all are the map object which will be holding key- value pairs. pageContext is real reference to PageContext object so that we can get any other implicit object as well as any attribute in any scope:-

getAtribute(String name)
getAtribute(String name, int scope)
findAttribute(String name)

getRequest();
getServletContext();
getServletConfig();
getSession();

scope are static final fields (in PageContext) as below:-

APPLICATION_SCOPE
REQUEST_SCOPE
SESSION_SCOPE
PAGE_SCOPE
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you see any tutorial, you'll be quite clear about this. 10 of them are maps, so actually they'll only contain key:value pairs for you.

pageScope
requestScope
sessionScope
applicationScope
param
paramValues
header
headerValues
cookie
initParam

The last one is pageContext object is of type PageContext so you can see what objects you can get from it...

[edit: my net is slow so I was late to the reply ]
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys excuse my message it was regarding the implicit objects you use in Scriptlets ;)
 
priya rishi
Ranch Hand
Posts: 119
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys for all your answers.

i am kind of clear with 10 map implicit objects.atleast i think so..

but with pageContext object its not quite clear -
eg:
if i want to print the request URI -
using scriplets:
<%= request.getRequestURI() %>

using EL:
${pageContext.request.requestURI }

so here the method getRequestURI() becomes property requestURI .
i know its intuitive to figure out the property name from method name.
but still i am used to check the api's .so do we have something for checking EL stuff.

(whereas, jsp implicit objects - methods remain as it is.
eg;
getServletContext().setAttribute("name","a");
application.setAttribute("name","a"); )
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the "get" prefix is a javabean standard. EL adds the get prefix to properties that you access from bean objects. So if you write bean.name, it will be like calling bean.getName(). The pageContext object's type is the actual PageContext. But you can only access the properties that follows the javabean naming convention, so you can only call the methods that have the "get" or "is" prefix. That is why you write pageContext.request, which is like pageContext.getRequest...
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All implicit objects and their type are listed in the JSP Specification, JSP.2.2.3 Implicit Objects.

so do we have something for checking EL stuff.

No. Once you know the type of the variable, you have to refer to the Java API.
 
priya rishi
Ranch Hand
Posts: 119
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EL adds the get prefix to properties that you access from bean objects.


I did know about the bean concept, but now i know that EL uses the same.Thanks.


All implicit objects and their type are listed in the JSP Specification, JSP.2.2.3 Implicit Objects.
Once you know the type of the variable, you have to refer to the Java API.



Thanks for clarifying the same.

 
Prabagaran Annamalai
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for the collective information!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic