tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: tomcat & url rewrite
Date Fri, 18 Sep 2009 15:54:58 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

William,

On 9/17/2009 10:30 PM, WILLIAMer wrote:
>> If you always start your URLs with a '/', then you shouldn't have a problem. 
>
> Could you explain this Sentence to me?

Uh... you should make sure all your URLs are absolute, not relative. IF
you have any URLs being generated in your application that contain ".."
or don't start with a "/" (or, better yet, request.getContxtPath() + "/"
...), then you should fix them.

> In my jsp, i write a href="./item_<s:property value="item" />.html" .
> Now, i need to change this link path to absolute path, right?

Yes. You should do this instead:

<a href="<%= request.getContextPath() %>/item_<s:property value="item"
/>.html"> ... </a>

Unfortunately, in this case, you are also not running your URL through
response.encodeURL, which you should always do. I'm not sure what the
best way to do that with JSTL or whatever tag libraries you are using,
so you'll have to look into that.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqzrVIACgkQ9CaO5/Lv0PB40ACgkzHJAjRFoFtf0B8knBrQuK2g
gWEAn1luBNCUczk5k4he79XFzQX63rmd
=wG4V
-----END PGP SIGNATURE-----

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


Mime
View raw message