I have a jsp with a NAV in it, which further contains and UL with the following elements as shown in the code below,
You need to invoke a servlet through href on the LI.
In the servlet, you need to use requestdispatcher to redirect to your jsp
RequestDispatcher dispatcher=getServletContext().getRequestDispatcher( "/WEB-INF/sample.jsp" );
dispatcher.forward( request, response );
=================EDIT : Sample Code =========================================
Index.html
<nav>
<ul>
<li class="current"><a href="/DynamicTest/MyServlet">Home</a></li>
<li><a>Access Control</a></li>
<li><a>Site Administration</a></li>
<li><a>Dashboard</a></li>
<li><a>Visitor Management</a></li>
</ul>
</nav>
Servlet code
@WebServlet("/MyServlet")
public class MyServlet extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher dispatcher = getServletContext()
.getRequestDispatcher("/WEB-INF/sample.jsp");
dispatcher.forward(request, response);
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
Jsp location :
WEB-INF/sample.jsp