Java Web:servlet分发请求到jsp
代码:
//只可以指定绝对路径
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/pages/test.jsp");
//可以指定绝对路径或相对路径
RequestDispatcher dispatcher = request.getRequestDispatcher("/pages/test.jsp");
dispatcher.forward(request, response);