-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

William,

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.

Hmm...

> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqyaNwACgkQ9CaO5/Lv0PBf3gCdHS61t5JZg2ZSjDXBQ5HxKI3N
5WAAni4/4yAaydwW41EOZ149jmFp6+XG
=5jHd
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to