Announcement Announcement Module
No announcement yet.
Directly forward to a JSP page Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Directly forward to a JSP page

    100% Spring Framework based web app. In the index.jsp page, I try to create a link that when I click on the link, it will forward to a JSP page such test.jsp. Something like this:

    <A href="What should I put here???">To Display Test Page</A>

    How can I do it?



  • #2
    If your JSPs are contained within the WEB-INF folder, as they should be, then what you are trying to do is not actually possible (because the browser will not be able to 'see' them). You'll have to put a URL which is mapped to a particular controller which then forwards to the JSP. Why do you need to do it directly?

    If your JSP is outside the WEB-INF, then you can link to it directly. The best way would be to build the correct URL using the JSTL Core library:

    <A href="<c:url value='test.jsp'/>">To Display Test Page</A>

    This ensures the full path is put in the HREF.