假设当前url为 http://localhost/login
请求路径为 http://localhost/ok
request
request.getRequestDispatcher("/servlet").forward(request,response);
执行结果后url为 http://localhost/ok
response
response.sendRedirect(request.getContextPath()+"/servlet");
执行结果后url为 http://localhost/servlet
但两者页面内容相同。