Unless you use special server-side tags, the path is resolved on
client. The browser knows nothing about your context. It only knows
the server name (myserver.com) and resource name (/images/pic.jpg).
Leading slash means "starting from the root" and that how browser
resolves the address.

Not being able to have context-relative links sucks, this is one of
the reasons why Struts, for example, has html:link tag.

On 4/14/06, Steven Huey <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I've got a setup with Apache 2.2, Mod_Jk 1.2.15, and Tomcat 5.5.16
> and things are working pretty well except for relative links in my
> webapp.
>
> When accessing my webapp at http://myserver.com/mywebapp/index.jsp
> any relative links within subdirectories of the mywebapp directory
> don't include /mywebapp/ in the URL. For example I have a mywebapp/
> includes/ directory and some of the files use links such as:
>
> <img src="/images/pic.jpg"/>
>
> Instead of linking to http://myserver.com/mywebapp/images/pic.jpg the
> link is http://myserver.com/images/pic.jpg.
>
> I've read that if I remove the leading "/" from the links it will
> work, but I already have a lot of links in this format and am
> wondering if there is a configuration change or something else I can
> do to resolve this.
>
> Thanks,
> Steve Huey

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to