File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Using pageContext in EL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Using pageContext in EL" Watch "Using pageContext in EL" New topic
Author

Using pageContext in EL

meera kanekal
Ranch Hand

Joined: Feb 13, 2005
Posts: 75
Hi,
The source code for this question is taken from the HFSJ book by KBB 2nd Edition, CH 8 page 380. Only the jsp is mine based on the source code.
Toy.java



Dog.java


Person.java


DogToyServlet


DogToys.jsp


So all the above work. But I want to access the "person" attribute using pageContext implicit object.
If I use the following I get an error.

From the PageContext API I found that the implicit object "request" is a ServletRequest. Then I tried the following in a scriptlet and it works.


So I am wondering if I can conclude that the did not work because the request is a ServletRequest and not a HttpServletRequest?
So the follow up question is do any of you know how I can access person's name using pageContext?

Sorry if the question seems lengthy but I thought it would be easy to follow if the code is pasted as well.

Thanks,
Meera

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16


You need to use the requestScope implicit object instead. It's a Map. ${pageContext.request} returns a ServletRequest instance, that's why ${pageContext.request.person} won't work. (There's is no getPerson() method in the ServletRequest class)


[My Blog]
All roads lead to JavaRanch
 
 
subject: Using pageContext in EL
 
Similar Threads
El property not found problem
EL - [ ] and .
EL s not running
EL doesn't work
Not working with 1.5