aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL implicit objects properties 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 "EL implicit objects properties" Watch "EL implicit objects properties" New topic
Author

EL implicit objects properties

priya rishi
Ranch Hand

Joined: Oct 26, 2008
Posts: 119
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 ..



SCJP 5 , SCWCD 5
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
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.


JDBCSupport - An easy to use, light-weight JDBC framework -
prashant k. gupta
Ranch Hand

Joined: May 15, 2008
Posts: 62
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

Joined: Aug 03, 2008
Posts: 9305
    
  17

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 ]

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Guys excuse my message it was regarding the implicit objects you use in Scriptlets ;)
priya rishi
Ranch Hand

Joined: Oct 26, 2008
Posts: 119
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

Joined: Aug 03, 2008
Posts: 9305
    
  17

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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
priya rishi
Ranch Hand

Joined: Oct 26, 2008
Posts: 119
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

Joined: Apr 11, 2013
Posts: 1
Thank you very much for the collective information!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EL implicit objects properties