-
sendRedirect error 404
about 9 years ago
-
about 9 years ago
I Understand your problem you cannot put the proper action value in login form that is
/SimpleLogInMVC/login
I have corrected your code please see the below code Enjoy :)
login.jsp
<%-- Document : login Created on : Sep 24, 2015, 7:17:22 PM Author : Jakub Lemiszewski --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>LogIn</title> </head> <body> <h1>Log In Here</h1> <form action="/SimpleLogInMVC/login" method="post"> <label>User Id</label> <input type="text" name="userId /"> <label>Password</label> <input type="password" name="password" /> <input type="submit" value="log in" /> </form> </body> </html>
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> <servlet> <servlet-name>LogInServlet</servlet-name> <servlet-class>Controller.Servlet.LogInServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>LogInServlet</servlet-name> <url-pattern>/login</url-pattern> </servlet-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app>
-
-
about 9 years ago
where is your login.jsp file please specify the correct path of that file. i can make the same example and it works properly.
I am attach the working example please see it and check what's wrong with you
-
2 Answer(s)