• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Doubt in jsp and el implicit objects

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

any more updates on this

Thanks
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic