Java request.getRequestDispatcher和response.sendRedirect don';行不通
是的,我知道这肯定是一个重复的问题。 但是我已经阅读了之前提出的问题的所有答案,试图解决所有问题。。。我的代码仍然不起作用 在index.jsp中:Java request.getRequestDispatcher和response.sendRedirect don';行不通,java,jsp,redirect,servlets,dispatcher,Java,Jsp,Redirect,Servlets,Dispatcher,是的,我知道这肯定是一个重复的问题。 但是我已经阅读了之前提出的问题的所有答案,试图解决所有问题。。。我的代码仍然不起作用 在index.jsp中: 及 在servlet“/Login”的post方法中: 我试着: "http://localhost:8080/home.jsp", "/home.jsp", "home.jsp" response.sendRedirect 尝试使用和不使用“return;” 什么也没有 我看到的只是空白页,而且: If doPost() 方法:url为 ”
及
在servlet“/Login”的post方法中:
我试着:
"http://localhost:8080/home.jsp",
"/home.jsp",
"home.jsp"
response.sendRedirect
尝试使用和不使用“return;”
什么也没有
我看到的只是空白页,而且:
If doPost()
方法:url为
”http://localhost:8080/Login“
。
If doGet()
方法:url与上述相同,加上输入表单的参数
你能帮我吗?如果你想用一个全新的请求将用户重定向到另一个页面,然后使用
sendRedirect
功能,但你必须将重定向发送到servlet
,servlet
将处理并返回给你一个页面。您不能将sendRedirect
直接发送到jsp
页面(您将重定向发送到一个jsp页面,就像您右键单击jsp页面并在服务器上运行它一样)。请参阅以查看sendRedirect
方法的使用
"http://localhost:8080/home.jsp",
"/home.jsp",
"home.jsp"