1、实现页面跳转
1.1 第一种实现方法通过 302和Location 实现
// 重定向到'/myProject/login.html '
.setStatus(302);
response.setHeader("Location","/myProject/login.html");
response
// 重定向到名为hello的servlet
.setStatus(302);
response.setHeader("Location","hello"); response
1.2 第二种实现方法( 推荐 )
// 重定向到'/myProject/login.html '
.sendRedirect("/myProject/login.html");
response
// 重定向到名为hello的servlet
.sendRedirect("hello"); response