This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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