Bonjour tout le monde ,

J ai un probleme avec ma servlet en fait j'ai créé une page login;jsp ,une servlet ,une page reponse.jsp et une page erreurs.jsp les voici :
login.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<%
//On récupére les valeurs necessaire à l'affichage
String login=(String)request.getAttribute("login");
String password=(String)request.getAttribute("password");
String urlAction=(String)request.getAttribute("urlAction");
%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="">
</head>
<body onload="preloadImages();" bgcolor="#806666"style="background: url() repeat-x top center #EEE3CE; margin-top: 3px; margin-bottom: 3px; margin-left: 130px; margin-right: 3px;">
<link href="css/cadre.css" rel="stylesheet" type="text/css">
<div id="contenu1">
<img src="pics/band.jpg"><br><br>
<div id="cadre">
 
	<div id="hautdroit"></div><div id="hautgauche"></div>
<div id="contenu">
<CENTER><h2><b>Authentification Utilisateur</b></h2> </CENTER>
       <font color="#FFCC66"> <CENTER><BR><b><H2>Bienvenu à*l'interface d'administration<br> du serveur Tchat sms</b></H2></CENTER></font>
 
  <form action="<%= urlAction %>" method="post">
   <table border="0" width="200" align="center">
    <tr>
     <td width="200"><b><font color="#FFCC66"><h2>Login</h2></font></b></td>
     <td width="200">
      <input type="text" name="login" value="<%= login %>" >
     </td>
    </tr>
    <tr>
     <td width="200"><b><font color="#FFCC66"><h2>Password</h2></font><b></td>
     <td width="200">
      <input type="password" name="password" value="<%= password %>" >
     </td>
    </tr>
    <tr>
    <td></td>
    <td align="left">
      <input type="submit"  value="Login">
     </td>
    </tr>
  </table> 
  </form>
  </div>
  <div id="basdroit"></div><div id="basgauche"></div>
</div>	
 
<style>
input   {border:1px blue solid;width:80px;}
body   {font-family:Tahoma;font-size:12px}
td      {font-family:Tahoma;font-size:12px}
</style>
 
 
</div>
</div>
</html>
Servletlogin
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package pack.sms.servlet.tchatsms;
import java.io.*;
import java.util.ArrayList;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
public class Servletlogin extends HttpServlet {
 
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	//Parametres d'instance
	/**private String defaultLogin = null;
	*private String defaultPassword = null;
	*/
	String urlMain = null;
	String urlLogin = null;
	String urlReponse = null;
	String urlErreurs = null;
	ArrayList erreurs = new ArrayList();
	//init
	public void init (){
	//On récupére les parametres d'initialisation de la servlet
		ServletConfig config = getServletConfig();
		urlMain = config.getInitParameter("urlMain");
		if (urlMain == null){
			erreurs.add("Le parametre [urlMain] n'a pas été initialisé");
		}
		urlLogin = config.getInitParameter("urlLogin");
		if (urlLogin == null){
			erreurs.add("Le parametre [urlLogin] n'a pas été initialisé");
		}
		urlReponse = config.getInitParameter("urlReponse");
		if (urlReponse == null){
			erreurs.add("Le parametre [urlReponse] n'a pas été initialisé");
		}
		urlErreurs = config.getInitParameter("urlErreurs");
	}
	/**
	 * @param request requete du client
	 * @param response reponse à construire
	 */
 
	//GET
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException ,
	ServletException {
	//On vérifie comment s'est passée l'initialisation de la servlet
		if(urlErreurs==null) throw new ServletException("Le parametre [urlErreurs] n'a pas été initialisé");
		if(erreurs.size()!=0){
			//on passe la main
			request.setAttribute("erreurs",erreurs);
			getServletContext().getRequestDispatcher(urlErreurs).forward(request,response);
			return;
		}//fin
 
	//on récupére les parametres
		String login=request.getParameter("login");
		String password=request.getParameter("password");
	//des parametres
		if(login==null || password==null){
		//on envoie le formulaire
			request.setAttribute("login","");
			request.setAttribute("password", "");
			request.setAttribute("urlAction", urlMain);
			getServletContext().getRequestDispatcher(urlLogin).forward(request, response);
			return;
		}//
		//vérification des parametres
		ArrayList erreursAppel=new ArrayList();
		login=login.trim();
		if(login.equals("")) erreursAppel.add("Le champs [login] n'a pas été rempli");
		password=password.trim();
		if(password.equals("")) erreursAppel.add("Le champs[password] n'a pas ete rempli");
		if(erreursAppel.size()!=0){
		//On envoie la page d'eereurs
			request.setAttribute("erreurs", erreursAppel);
			getServletContext().getRequestDispatcher(urlErreurs).forward(request,response);
			return;
		}//if
	//les parametres sont corects - on envoie la page réponse
		request.setAttribute("login", login);
		request.setAttribute("password", password);
		getServletContext().getRequestDispatcher(urlReponse).forward(request, response);
		return;			
 
	}
	/**
	 * @param request la requete HTTP du client
	 * @param response la reponse HTTP qu'on va construire
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException,
	ServletException {
	//On passe la main du GET
		doGet(request, response);
	}
}
reponse.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<%
//On récupére les données
String login=(String)request.getAttribute("login");
String password=(String)request.getAttribute("password");
if(login==null) login=rane";
if(password==null) pasdword="rane";
%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="">
</head>
<body onload="preloadImages();" bgcolor="#806666"style="background: url() repeat-x top center #EEE3CE; margin-top: 3px; margin-bottom: 3px; margin-left: 130px; margin-right: 3px;">
<link href="css/cadre.css" rel="stylesheet" type="text/css">
<div id="contenu1">
<img src="pics/band.jpg"><br><br>
<div id="cadre">
 
	<div id="hautdroit"></div><div id="hautgauche"></div>
<div id="contenu">
<CENTER><h2><b>Authentification Utilisateur</b></h2> </CENTER>
       <font color="#FFCC66"> <CENTER><BR><b><H2>Bienvenu à*l'interface d'administration<br> du serveur Tchat sms</b></H2></CENTER></font>
 
  <form method="post" action="">
   <table border="0" width="200" align="center">
    <tr>
     <td width="200"><b><font color="#FFCC66"><h2>Login</h2></font></b></td>
     <td><%= login %>
     </tr>
    <tr>
     <td width="200"><b><font color="#FFCC66"><h2>Password</h2></font><b></td>
     <td><%= password %>
     </tr>
    <tr>
    <td></td>
    <td align="left">
      <input type="submit" name="submit" value="login">
     </td>
    </tr>
  </table> 
  </form>
  </div>
  <div id="basdroit"></div><div id="basgauche"></div>
</div>	
 
<style>
input   {border:1px blue solid;width:80px;}
body   {font-family:Tahoma;font-size:12px}
td      {font-family:Tahoma;font-size:12px}
</style>
 
 
</div>
</div>
</html>
erreurs.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
<%@ page import="java.util.ArrayList" %>
 
<%
//on récupere les données
ArrayList erreurs=(ArrayList)request.getAttribute("erreurs");
%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="">
</head>
<body onload="preloadImages();" bgcolor="#806666"style="background: url() repeat-x top center #EEE3CE; margin-top: 3px; margin-bottom: 3px; margin-left: 130px; margin-right: 3px;">
<link href="css/cadre.css" rel="stylesheet" type="text/css">
<div id="contenu1">
<img src="pics/band.jpg"><br><br>
<div id="cadre">
 
	<div id="hautdroit"></div><div id="hautgauche"></div>
<div id="contenu">
<CENTER><h2><b>Authentification Utilisateur</b></h2> </CENTER>
       <font color="#FFCC66"> <CENTER><BR><b><H2>Bienvenu à*l'interface d'administration<br> du serveur Tchat sms</b></H2></CENTER></font>
       <h2>Les erreurs suivantes se sont produites</h2>
       <ul>
       <%
       for(int i=0;i<erreurs.size();i++){
       out.println("<li>" + (String) erreurs.get(i) + "</li>\n");
       }//for
       %>
       </ul>
       </div>
       </div>
       </div>
       </body>
       </html>
et voici le 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
22
23
24
25
26
27
28
29
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<servlet>
		<servlet-name>logintchatsms</servlet-name>
		<servlet-class>pack.sms.servlet.tchatsms.Servletlogin</servlet-class>
		<init-param>
			<param-name>urlMain</param-name>
			<param-value>tchatsms/main</param-value>
		</init-param>
 
		<init-param>
			<param-name>urlReponse</param-name>
			<param-value>reponse.jsp</param-value>
		</init-param>
		<init-param>
			<param-name>urlErreurs</param-name>
			<param-value>erreurs.jsp</param-value>
		</init-param>
		<init-param>
			<param-name>urlLogin</param-name>
			<param-value>login.jsp</param-value>
		</init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>logintchatsms</servlet-name>
		<url-pattern>/main</url-pattern>
	</servlet-mapping>
</web-app>
et une fois la page login validé il me renvois cette erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
ype Rapport d'�tat
 
message /tchatsms/null
 
description La ressource demand�e (/tchatsms/null) n'est pas disponible.
Merci de bien vouloir m'aider