It's not a secret anymore!
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in jsp and el implicit objects 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 "Doubt in jsp and el implicit objects" Watch "Doubt in jsp and el implicit objects" New topic

Doubt in jsp and el implicit objects

raja ram
Ranch Hand

Joined: Mar 02, 2008
Posts: 169

We have JSP implicit Objects request,session,application,page and EL implicit Objects like requestScope,sessionScope,applicationScope and pageScope i wanted to know the difference between them I have read about these in HFSJ that requestScope will not have actual refrence of the Actual instance of request rather it can access only the attributes of the request and not the properties of request object

can any body please explain me clearly with an example the differences between these implicit objects.

Ramkumar Rao

Joined: Jun 03, 2008
Posts: 4
Hi Raja,

You have the answer for your question. requestScope is not an instance of HttpServletRequest, rather its an implicit Map object provided by EL. So it can be used to get the attributes value from the request scope. We have to use pageContext implicit object to get the request object in EL.

Whereas, the request implicit object given by JSP is an instance of HttpServletRequest and can be used to access all the methods in the ServletRequest interface.
raja ram
Ranch Hand

Joined: Mar 02, 2008
Posts: 169

any more updates on this

Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
requestScope is a reference to request attributes, not a reference to HttpServletRequest. If you check the API of HttpServletRequest you will find alot of methods that you can't invoke unless you have a reference to an HttpServletRequest object.

this means that you can't say:
requestScope.getInputStream() OR
if you need to do so then you would have to use the pageContext, something like pageContext.request.requestURI

you can only access attributes of request scope: requestScope.attribute_name.
Hope that cleared it.
[ June 04, 2008: Message edited by: Musab Al-Rawi ]

I agree. Here's the link:
subject: Doubt in jsp and el implicit objects
jQuery in Action, 3rd edition