protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("帮我办个事"); System.out.println("不,我找个人帮你办"); // servlet转发 将请求向下传递 ServletContext application = this.getServletContext(); RequestDispatcher rd = application.getRequestDispatcher("/abc");//括号内填写转发的目标servlet的urlPatterns rd.forward(request, response); }
servlet的转发(dispatcher)
Title:servlet的转发(dispatcher)
Author:梅守强
Created:2018-06-18, 21:46:57
Updated:2018-06-18, 21:53:01
Full URL:http://yoursite.com/2018/06/18/ServletDispatcher/
License: "CC BY-NC-SA 4.0" Keep Link & Author if Distribute.