tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: <a href to another JSP
Date Tue, 07 Apr 2009 19:24:23 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

MT,

On 4/5/2009 10:24 PM, Mighty Tornado wrote:
> I have an index.jsp page with 3 links to other JSP's.
> These links don't seem to work. I get the 404 error.

If you're getting a 404, then your URLs are incorrect.

> Do I have to register the JSP's somewhere similarly to how I create servlet
> mappings?

These are not necessary: The JSPServlet handles all requests to *.jsp URLs.

> in the href attribute I tried passing along both relative path - since all my
> JSP's are in one directory called JSP under the app root so I wrote
> something like "./mission.jsp"
> And I also tried giving the absolute path - "/JSP/mission.jsp" - no luck.

You should not do either. Your URLs should look like this:

<a href="<%= response.encodeURL(request.getContextPath() +
"/mission.jsp") %>">your link text</a>

If you are using a tag library to build your URLs, you should always
begin your URLs with a '/', and the tag library will take care of adding
the context path and the jsessionid (if necessary).

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

iEYEARECAAYFAknbqGcACgkQ9CaO5/Lv0PAJOwCfQHredIEIZ/rfFQB7KwepDxlj
QdwAoLGMInRLgZ41wGbmbvYmNOrT2/Iy
=1Jy0
-----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