您需要通过LI上的href调用servlet。
在Servlet中,您需要使用requestdispatcher重定向到您的jsp
RequestDispatcher dispatcher=getServletContext().getRequestDispatcher( "/WEB-INF/sample.jsp" );dispatcher.forward( request, response );
=================编辑:示例代码============================= ============
Index.html
<nav> <ul> <li ><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代码
@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位置:
WEB-INF/sample.jsp



