Alternatively, you can set a BASE reference within the HEAD element of each
page, and then use relative-paths in all your URLs:


<head>
    ...
    <base href="http://www.webadorable.com/your-app-context-name-here/"/>
    ...
</head>

...

<img src="relpath/to/image.jpg"/>


The BASE value can (should!) be set dynamically, of course - with a tag
library, or whatever.

Notice that the BASE reference has a trailing slash, whilst your relative
paths must start without a leading slash.

Harry Mantheakis


> Is there any reason you can't just have the paths composed dynamically?:
> 
> <img src="${pageContext.request.contextPath}/webapp/relpath/to/image.jpg" />
> 
> For the ROOT webapp, the expression will return an empty path, so it's
> always correct.
> 
> --David
> 
> Vernon _ wrote:
>> 
>> I have another new application deployed in a non-root directory. I
>> need to have absolute paths for CSS and Javascript in order to import
>> them properly with differenct level structure of JSP files. I can
>> deploy it as the root application or add the application name in the
>> absolute path. Neither solutions are very good. Any good practise to
>> solve this issue?
>> 
>> Thanks,
>> 
>> Vernon
>> 
>> _________________________________________________________________
>> Find a local pizza place, music store, museum and moreĀŠthen map the
>> best route! http://local.live.com?FORM=MGA001
>> 
>> 
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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

Reply via email to