You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by otisg <ot...@ureach.com> on 2004/03/03 18:31:07 UTC

Re: Getting request URI with JSTL

I had mailed this over a weekend....not a good time to mail :)

Does anyone know how to get '/Action.do' or even
'/context/Action.do' from a request such as
http://www.example.com/context/Action.do?foo=bar ?

Using JSTL.

When I use JSTL to get various request properties, I only get
JSPs used to create the page, and not real request elements,
like '/Action.do'.

Thanks,
Otis




________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


---- On Sat, 28 Feb 2004, otisg (otisg@ureach.com) wrote:

> Hello,
> 
> I am trying to use JSTL to get the part of the request URI
that
> is after the contextPath, and before the Query String.
> 
> For example:
> If a request is http://...../context/Action.do?x=y
> I would like to get a hold of 'Action.do' part of the String.
> 
> Is there a way to get to this using JSTL?
> I have tried using JSTL to print all kinds of
HttpServletRequest
> properties using <c:out value="${pageContext.request}"/>.
> 
> However, request.requestURI, request.requestURI, etc. always
> give me names of JSPs, and not the request URI, like the one
> above.
> 
> If I print out the value of request.getRequestURI/URL from a
> Servlet or Action, then I DO get the actual request URI
String. 
> But not from JSTL.
> 
> Is this possible with JSTL?
> 
> Thanks,
> Otis
> P.S.
> In case anyone is wondering...
> I have a web app with a set of tabs.
> I need to figure out a mechanism that will allow me to
highlight
> (or colour) the one that the user is on.
> I am trying to use request URIs as the basis on the colouring
> knowledge.
> If user requested /X.do, then highlight tab X.
> If user requested /Y.do, then highlight tab Y.
> 
> This logic should reside inside of one of the JSPs, so that is
> why I am looking for a JSTL solution.
> 
> Maybe there are better ways....
> 
> 
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
taglibs-user-help@jakarta.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Getting request URI with JSTL

Posted by Hassan Schroeder <ha...@webtuitive.com>.
otisg wrote:

> Does anyone know how to get '/Action.do' or even
> '/context/Action.do' from a request such as
> http://www.example.com/context/Action.do?foo=bar ?

<c:out value="${pageContext.request.servletPath}"/>	

HTH,
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org