On 10/27/05, Laurie Harper <[EMAIL PROTECTED]> wrote:
>
> I feel like I should know the answer to this one but I seem to be
> stumped... How do I get the actual request URI (or URL) in a JSP that's
> included via Tiles?
>
> Both ${pageContext.request.requestURI} and
> ${pageContext.request.requestURL} are pointing to the Tiles layout JSP,
> whether or not I include an <html:base/> tag in the <head> section in
> the layout.
>
> To be exact, what I actually need is the full context-relative request
> path -- and I'm using URL prefix mapping, so for example the URL I
> browse to would be http://host/bin/some/path and the bit I need is
> '/some/path'.


If you're within the context of a RequestDispatcher.include() -- which is
what Tiles is doing under the covers -- the servlet container promises to
create some request attributes for you that contain useful information about
the included URI, rather than the original request URI. In particular, the
attribute named "javax.servlet.include.request_uri" will include what you
are looking for. Other attributes of interest:
* javax.servlet.include.context_path
* javax.servlet.include.servlet_path
* javax.servlet.include.path_info
* javax.servlet.include.query_string

(See section SRV.8.3.1 of the Servlet Spec for more info.)

Craig


Thanks,
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to