tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexeiych <>
Subject Re: Path
Date Wed, 16 Sep 2009 16:34:55 GMT

I have similar problem. 
However since I use JSF all my links and references are defined in
faces-config.xml file.

${pageContext.request.contextPath} is not very clean solution since one
definitely do not want this statements across all JSPs, Servlets, config
files, etc.

For example in Oracle App Server you can configure such behavior in

Is there any way to configure Tomcat so that it treats
http://localhost:8888/myApp/ as a root context for building absolute paths
within myApp?


coubeatczech wrote:
> David Smith-2 wrote:
>> No need to edit any *.xml files. 
>> Your webapp already knows what it's context path is when the request
>> comes in.  The expression I wrote is used in jsp pages to compose server
>> absolute links to resources like jsps, html pages, images, javascript,
>> css, etc., ...  Consider it in the context of:
>>  ${pageContext.request.contextPath}/jsp/any.jsp Click here to
>> (whatever) 
>> If you are working with a servlet instead of a jsp, it would be
>> request.getContextPath() + "/jsp/any.jsp" to build links where request
>> is an instance of javax.servlet.http.HttpServletRequest.
>> --David
> Great, thanks, it answered my question, it works now and I'm almost
> absolutely happy. :-)

View this message in context:
Sent from the Tomcat - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message