je travaille avec Myeclipse
voici le code de ma jsp:
et voici le code dema 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
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 <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%@ page import = "javax.servlet.http.HttpSession"%> <html > <head> <meta http-equiv="Content-Language" content="fr"> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Gestion du Parc Téléphonique - AMENHYD</title> <script type="" language = "Javascript"> function Validate(){ var Name=document.Index.Name var Pass=document.Index.Pass if ((Name.value==null)||(Name.value=="")){ alert("Entrez votre nom d'utilisateur") Name.focus() return false } if ((Pass.value==null)||(Pass.value=="")){ alert("Entrez votre mot de passe") Pass.focus() return false } return true } </script> </head> <body> <form name = "Index" action="Index" onSubmit="return Validate()" > <% session.setAttribute("Name", "ggg"); %> <div align=center> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; position: absolute; left: 440px; top: 68px; height: 214px;" bordercolor="#FFCC66" width="428" align="left" bgcolor="#FFCC66"> <tr> <td width="101%" colspan="2" height="48" bordercolor="#FF9900" bgcolor="#FF9900"> <p align="center"><font color="#ffffff"><font size="5"><font face="Calibri"><b>Authentification</b></font></font></font></p><br></td> </tr> <tr> <td width="43%" height="32"><font face="Calibri"> </font> <p><font face="Calibri"> Nom d'utilisateur:<span lang="ar-dz"> </span> </font></td> <td width="57%" height="32"> <p> <input name="Name" size="26" style="font-family: Calibri; font-size: 12pt; border: 1px solid #FFCC66"></td> </tr> <tr> <td width="43%" height="33"><font face="Calibri"> Mot de passe:</font></td> <td width="57%" height="33"> <input name="Pass" size="26" style="font-family: Calibri; font-size: 12pt; border: 1px solid #FFCC66" type="password"> </td> </tr> <tr> <td width="44%" height="51" bgcolor="#FFCC66" style="border-style: solid; border-width: 1" bordercolor="#FFCC66"> </td> <td width="57%" height="51" bgcolor="#FFCC66" style="border-style: solid; border-width: 1" bordercolor="#FFCC66"> <input type="submit" value="Connexion" name="btn" style="font-family: Calibri; font-size: 10pt; position: relative; font-weight: bold" > </td> </tr> <tr> <td width="101%" height="23" colspan="2" bordercolor="#008000" bgcolor="#FF9900" style="border-style: solid; border-width: 1"> <p align="center"><font color="#FFFFFF"><i><b><font face="Calibri" size="2"> </font><span style="line-height: 115%; font-family: Calibri"> <font size="2"><br></font></span></b></i></font></td> </tr> </table> </div> </form> </body> </html>
mais il me signle que la ressource n'est pas diponible
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 import java.io.IOException; import java.io.PrintWriter; import java.util.Map; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class Index extends HttpServlet { private static final long serialVersionUID = 1L; private boolean jj; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("Name"); String pass = request.getParameter("Pass"); PrintWriter out = response.getWriter(); response.setContentType("text/html"); RequestDispatcher dispatcher = null; HttpSession session = request.getSession(); session.getAttribute("Pass"); ADAuthenticator ada = new ADAuthenticator("xx.xx", "ldap://172.16.0.100:310", "dc=xx,dc=xx"); Map umap = ada.authenticate(name,pass); if (umap == null) { out.println("<html><head> <script> alert ('Identifiant ou mot de passe incorrect!!');window.location='Index.jsp'; var Pass=document.Index.Pass ;Pass.focus();</script></head><body>"); out.println("</body></html>"); } else { dispatcher = request.getRequestDispatcher("/AjoutM.jsp"); dispatcher.forward(request, response); } } }
Partager