Bonjour à tous,
voici mon code du servlet
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
import java.io.*; 
import java.sql.*; 
import javax.servlet.*; 
import javax.servlet.http.*; 
 
public class LoginAuthentication extends HttpServlet { 
 
        private ServletConfig config; 
 
        @Override 
        public void init(ServletConfig config) 
                throws ServletException { 
        this.config = config; 
        } 
 
        @Override 
        public void doPost(HttpServletRequest request, HttpServletResponse response) 
                throws ServletException, IOException { 
 
        PrintWriter out = response.getWriter(); 
        response.setContentType("text/html"); 
 
        out.println("<html><head><title>welcome page</title></head><body>"); 
        out.println("<h1>Welcome </h1>"); 
        out.println("</body></html>"); 
        out.close(); 
 
        } 
}
le code de ma page jsp:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
 
<html > 
 
        <head> 
        <title>Login Page</title> 
        <script type=""  language = "Javascript"> 
                function Validate(){ 
                var user=document.frm.user 
                var pass=document.frm.pass 
 
                if ((user.value==null)||(user.value=="")){ 
                alert("Please Enter user name") 
                user.focus() 
                return false 
                } 
                if ((pass.value==null)||(pass.value=="")){ 
                alert("Please Enter password") 
                pass.focus() 
                return false 
                } 
                return true 
                } 
        </script> 
        </head> 
        <body> 
        <h1>Login 
                <br> 
        </h1> 
        <form name="frm" action="LoginAuthentication" method="post" onSubmit="return Validate()" > 
                Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="user" value=""/><br> 
                Password:<input type="password" name="pass" value=""/><br> 
                <br>&nbsp;&nbsp;&nbsp;<input type="submit" value="Sign-In" /> 
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="Reset" /> 
        </form> 
        </body> 
</html>
le code de web.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
 
<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 
        <servlet> 
        <servlet-name>LoginAuthentication</servlet-name> 
        <servlet-class>LoginAuthentication</servlet-class> 
        </servlet> 
        <servlet-mapping> 
        <servlet-name>LoginAuthentication</servlet-name> 
        <url-pattern>/LoginAuthentication</url-pattern> 
        </servlet-mapping> 
        <session-config> 
        <session-timeout> 
                30 
        </session-timeout> 
        </session-config> 
        <welcome-file-list> 
        <welcome-file>index.jsp</welcome-file> 
        </welcome-file-list> 
</web-app>
j'ai l'erreur suivante
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
 
Etat HTTP 404 - /GLT/LoginAuthentication 
 
-------------------------------------------------------------------------------- 
 
type Rapport d'état 
 
message /GLT/LoginAuthentication 
 
description La ressource demandée (/GLT/LoginAuthentication) n'est pas disponible