request Dispatch
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("forwardServlet doGet..."); //转发 request.setAttribute("name", "abcde"); String path = "loginServlet"; RequestDispatcher requestDispatcher = request.getRequestDispatcher("/"+path); requestDispatcher.forward(request, response); }