Bonjour tout le monde,
j'ai un petit pb avec mon serveur , mais je ne sais pas d'ouvient l'erreur.
j'ai 1 jsp qui renvoi vers 1 servlet, mais apres le deploiment de l'appli, j'ai l'err 404;
voici ma serlet :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 HTTP Status 404 - /LoginServlet -------------------------------------------------------------------------------- type Status report message /LoginServlet description The requested resource (/LoginServlet) is not available. -------------------------------------------------------------------------------- Apache Tomcat/5.5
et mon fichier 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138 package com.ge.health.em.agr.servlet; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import com.ge.health.em.agr.db.DBManager; public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(LoginServlet.class.getName()); /** * Constructor of the object. */ public LoginServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String login = request.getParameter("login"); String passwd = request.getParameter("passwd"); DBManager db=null; Connection ct=null; Statement st=null; ResultSet rs=null; String query=""; query = "select NOM, PRENOM, DEMANDEUR_ID from AGR_DEMANDEUR where NOM =" + login ; try{ db = DBManager.getInstance(); ct = db.getConnection(); st = ct.createStatement(); rs = st.executeQuery(query); if(rs!=null){ HttpSession session = request.getSession(true); session.setAttribute("admin",login); if (passwd == ("admin"+rs.getInt("DEMANDEUR_ID")+"")) { if (!(login.equals("null")) && login.equals(rs.getString("NOM"))) { String newURL = "/jsp/agr_consult/agr_search.jsp"; response.sendRedirect(newURL); } // fin admin } else if (!(login.equals("null")) && login.equals(rs.getString("NOM")) && passwd.equals(rs.getString("PRENOM"))) { } else { out.println("<h3> Incorrect login information </h3>"); } } } catch (SQLException sqlEx){ logger.error("SQLException in table Agr_Demandeur LOGIN() : " + sqlEx); } catch (Exception e){ logger.error("Exception in table Agr_Demandeur LOGIN() : " + e); }finally{ try { rs.close(); rs = null; db.finalClose(st, ct); } catch (SQLException sqlEx) { logger.error("SQLException while closing ResultSet OR Connection in insertSQL() : " + sqlEx); } } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occure */ public void init() throws ServletException { // Put your code here } }
Alors que pour les autres servlet que j'avais deja creé de la meme maniere, marchent tres bien ??
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.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <distributable/> <servlet> <description>une servlet pour se logger</description> <servlet-name>LoginServlet</servlet-name> <servlet-class>com.ge.health.em.agr.servlet.LoginServlet</servlet-class> </servlet> ... .. <welcome-file-list> <welcome-file>/jsp/index.jsp</welcome-file> </welcome-file-list> </web-app>
Partager