请求转发特点:
关键代码:
ServletDispatcher requestDisatpther = request.getRequestDispatcher(“/servlet2”);指向Servlet2
requestDisatpther .forward(request,response);前进到Servlet2
请求重定向特点:
关键代码:
response.sendRedirect(“http://localhost:8080/工程名/response2”)//默认状态码302,响应头Location对应http://localhost:8080/工程名/response2地址
原文:https://www.cnblogs.com/zr961224/p/13287960.html