Hi, 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. Do I have to register the JSP's somewhere similarly to how I create servlet mappings? in the href attribute I tried passing along both relative path - sine 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. Thanks.
-----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
Mighty Tornado wrote: > Hi, > 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. > > Do I have to register the JSP's somewhere similarly to how I create servlet > mappings? > > in the href attribute I tried passing along both relative path - sine all my > JSP's are in one directory called JSP under the app root so I wrote > something like "./mission.jsp" why? <a href="mission.jsp">...</a> should be sufficient if you've actually got a document called "mission.jsp" in the same directory as the one that contains the link. > And I also tried giving the absolute path - "/JSP/mission.jsp" - no luck. That's only the absolute path if your web application is the ROOT one, if it's not and your app is called "foo" then the path is "/foo/JSP/mission.jsp". > Thanks. > You've posted enough times to know: Tomcat version, JVM version, OS version. p --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org