You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by santhoshihrd <sa...@realtybargains.com> on 2007/03/08 06:41:01 UTC

Re: [OT] getting context path name

David,
   Many thanks. This was the sort of solution I was searching for. It is
working fine
Santhosh




David Smith-2 wrote:
> 
> request.getContextPath() should supply what you need.  If the webapp is 
> the ROOT webapp, it will return an empty string.  That just makes it 
> easy to write stuff like:
> 
>  ${pageContext.request.contextPath}/images/myMasthead.jpg 
> 
> If you really need the ROOT webapp to return "/", then you'll just have 
> to test for an empty string and handle that as a special case.
> 
> --David
> 
> santhoshihrd wrote:
>> Hi all,
>>    I have an issue 
>> I have a context nemed "demo" with the following configuration
>> <Context path="/demo" docBase="webapps/MyWebApp.war" 
>>          debug="0" privileged="true">
>> </Context>
>>
>> I want to get the context name "demo" in a servlet . I am using Spring
>> framework. It will be more usefule if I get it in Dispatcher servlet. If
>> I
>> am deploying the context in "/" , I should get it as "/"
>> <Context path="/" docBase="webapps/MyWebApp.war" 
>>          debug="0" privileged="true">
>> </Context>
>>
>> Thanks in advance
>>
>>
>>
>>   
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/getting-context-path-name-tf3362065.html#a9368900
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org