Bonjour,
Je travaille avec le Serveur Tomcat 5.5.4 vous exécuter des servlets mais le problême c'est q'il me donne un erreur.
Vois le code de la servlet et l'erreur:
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
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.lang.*;
import java.sql.*;
public class Login extends HttpServlet {
    public void init() throws ServletException {
 String driver="com.sybase.jdbc.SybDriver";
 try { // enregistrement du driver
     Class.forName (driver);
 } catch(ClassNotFoundException e){
     throw new ServletException("je trouve pas "+driver);
 }
    }
public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out=response.getWriter();
response.setContentType("text/html");
 out.println("<HTML><HEAD><TITLE>");
 out.println(title);
 out.println("</TITLE></HEAD><BODY>");
 out.println("<H1> Logged In </H1>");
 try { // connexion et execution de la requete
    Connection con = DriverManager.getConnection (request.getParameter("url"),request.getParameter("name"),request.getParameter("passwd"));
    HttpSession session = request.getSession(true);
    session.setAttribute("con",con);
    out.println("<FORM action=\"/myserv/servlet/Query\" method=\"post\">");
      out.println("<P>");
Voici l'erreur:
Etat HTTP 404 - /myserv/servlet/Login
--------------------------------------------------------------------------------
type Rapport d'état
message /myserv/servlet/Login
description La ressource demandée (/myserv/servlet/Login) n'est pas disponible.

--------------------------------------------------------------------------------
Apache Tomcat/5.5.4
Voici mon Web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.3.dtd">
<web-app>
<servlet>
<servlet-name>Login</servlet-name>
<servlet-class>Login</servlet-class>
<init-param>
<param-name>
foo
</param-name>
<param-value>
bar
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Login</servlet-name>
<servlet-class>Login</servlet-class>
<url-pattern>/servlet/Login</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
</security-constraint>
<security-role>
<role-name>role1</role-name>
</security-role>
<security-role>
<role-name>tomcat</role-name>
</security-role>
</
web-app>