I'm sending a user to a servlet Login
where the doPost method is:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("hit login doPost");
response.sendRedirect("account.jsp");
}
It prints "hit login doPost" when I debug, but skips right over the second line where I'm wanting to redirect. Here is my form (this is on index.jsp
page):
<form action="Login" method="post">
<button type="submit">Login</button>
</form>
Does anyone know what's going on here?
With a combination of stopping tomcat, removing the project from the local tomcat server in eclipse, right clicking on the project name and 'Build Project', and re-running on the server it finally worked. I was simply restarting the server, and I guess it wasn't rebuilding with my changes automatically.
So, to clarify I took these steps to ensure my dynamic web project took servlet changes:
Build Project
For some reason, it wouldn't take changes unless I've done every single step above.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.