This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Which EL expression evaluates to the request URI?
the request object in EL is a Map of request attributes. So you can't access normal request values from it. The pageContext.request represents the normal HttpServletRequest object so you can access the request URI from it...
There is no implicit request object in EL.There is a requestScope object which is a map of the request scope attributes.It is not the request object itself.
And requestURI(a String containing the part of the URL from the protocol name up to the query string) is a property of request ( HttpServletRequest).
For getting request properties, we need pageContext implicit object of EL. pageContext is used to access the JSP's regular implicit objects such as application, session and request.
The easiest way for me not to forget is remembering that:
- pageContext is the only actual reference to an actual object (PageContext) which you can then use to access other normal implicit objects (request, application, session) e.t.c
all the others EL implicit objects are Map to, for example, access attributes, initialization parameters, e.t.c.
Regards, Siphiwe Madi
[SCJP, SCWCD, __] Next ... scjwsd