Search code examples
jspjstljsp-tags

what is the best way to navigate from one jsp page to another using JSP tags?


I have an index.jsp I want to provide multiple links on this page to other JSP pages. Under Web Content, I have a folder JSPViews which contains all the jsp pages whose link I want to provide on the index.jsp


Solution

  • You could indeed use <a href> tags,

    And as you said you have them in the same folder you dont need to worry about directory listings,

    just use like below,

    <a href="b.jsp">b</a>
    <a href="c.jsp">c</a>
    

    If you need to navigate through a servlet , then you could use something like this ,

    <a href="TestServlet?paramName="test">TestServletLink</a>
    

    NOTE : paramName indicates the parameter you are passing to the servlet .

    Hope this helps!!