tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: tomcat & url rewrite
Date Thu, 17 Sep 2009 16:50:36 GMT
Hash: SHA1


On 9/16/2009 10:04 PM, WILLIAMer wrote:
> Let me say sorry for i didnt description the error.
> The error like the path is mapping incorrectly.

So, what error message do you get?

> So the image or css are not display because of the path not find.


> A part of my application structure like under
> /tomcat/webapps/myApp/images
>                                  /css
>                                  /Admin/index.jsp
>                                  /index.jsp
> I set my application to be ROOT.
> The url http://myDomain/ will go my application instead of
> http://myDomain/myApp.   
> Why i say http://myDomain/item_pd12/34.html let me confuse? 
> Because i didnt have the directory named item_pd12.

Oh, that will certainly be a problem. This is one of the hazards of
playing games with your URLs: if you use relative URLs for static
content, things break when you change the base URL of the web page.

The solution? Always use fully-qualified URLs (see
HttpServletResponse.encodeURL and request.getContextPath).

> In my jsp code, i really write some code for image or css path.
> Something like <%String sImagePath = "/myApp/images";%>.
> For this case http://myDomain/item_pd12/34.html.
> I guess tomcat will to find the directory named item_pd12 under /myApp dir
> and didnt find my images though the sImagePath.

If you always start your URLs with a '/', then you shouldn't have a problem.

> Another question, after i touch http://myDomain/item_pd12/34.html,
> link other page would stuck with http://myDomain/item_pd12/otherPage.
> But the really url i want would like http://myDomain/otherPage.

Then write your URLs properly, starting with a '/'.

> Maybe i need to improve my code though something like relative path instead
> of absolute path.

No, you need an absolute path instead of a relative path.

- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


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

View raw message