aspose file tools*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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
Author

Doubt in jsp and el implicit objects

raja ram
Ranch Hand

Joined: Mar 02, 2008
Posts: 169
Hi,

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.

Thanks
Ramkumar Rao
Greenhorn

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
Hi,

any more updates on this

Thanks
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
requestScope.inputStream.
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 ]

SCBCD - SCWCD - SCJD - SCJP - OCA
 
Don't get me started about those stupid light bulbs.
 
subject: Doubt in jsp and el implicit objects