tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas LE BAS <nle...@bigfoot.com>
Subject Re: Request Method Values
Date Sun, 05 Aug 2007 18:00:58 GMT
Antonio Petrelli a écrit :
> 2007/8/5, Chris Pratt <thechrispratt@gmail.com>:
>   
>> I'm trying to create a tile that generates a menu where the menu items
>> are sensitive to the page they're on, but for some reason I can't seem
>> to figure out how to find the current page.  When I try:
>>
>> <!--
>> req.getPathInfo()              = ${pageContext.request.pathInfo}
>> req.getPathTranslated()          = ${pageContext.request.pathTranslated}
>> req.getRequestURI()          = ${pageContext.request.requestURI}
>> req.getRequestURL()          = ${pageContext.request.requestURL}
>> req.getServletPath()         = ${pageContext.request.servletPath}
>> -->
>>
>> it generates:
>>
>> <!--
>> req.getPathInfo()              =
>> req.getPathTranslated()          =
>> req.getRequestURI()          = /layout/default-layout.jsp
>> req.getRequestURL()          =
>> http://anodyzed.planetpratt.com/layout/default-layout.jsp
>> req.getServletPath()         = /layout/default-layout.jsp
>> -->
>>
>> which tells me what layout I'm using, but not what the actual request
>> was.  Is there any way to get access to the page name?
>>     
>
> I suppose the answer is "no", at least directly.
> Your problem will be the same even if you don't use Tiles, because,
> when you forward to a JSP page, the latest request URI will be that
> JSP page.
> But the question is: do you want to create a customized menu depending
> on the definition name?
> In this case, I think you should look the concept of "preparer":
> http://tiles.apache.org/tutorial/advanced/preparer.html
>
> Ciao
> Antonio
>
>
>   
It is indeed a problem with the Servlet API, not tiles. The solution
came with Servlet 2.4 : the following request attributes hold the
original request information after a forward or an include.

javax.servlet.forward.request_uri
javax.servlet.forward.context_path
javax.servlet.forward.servlet_path
javax.servlet.forward.path_info
javax.servlet.forward.query_string

javax.servlet.include.request_uri
javax.servlet.include.context_path
javax.servlet.include.servlet_path
javax.servlet.include.path_info
javax.servlet.include.query_string

Hope this helps
Nick


Mime
View raw message