Redirection imposible

1 post / 0 new
artotal
Redirection imposible

Bonjour,
j'ai un servlet qui reçois le paramètre d'un formulaire et je voudrai qu'il redirige sur un fichier html ou sur un autre servlet. Mais le servlet affiche une page blanche, sans diriger ?

package ProjetIteration;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

 public class TechSupportServlet extends javax.servlet.http.HttpServlet 
 implements javax.servlet.Servlet 
 {
   String userName,password,mailF,logicielF,systemeF,problemeF;
   String protocol;
     private String urlConnection = "jdbc:mysql://localhost:3306/frontal";
     private String loginConnection = "root";
     private String passConnection = "xav";
     
     public void init()
     {
         try {
             Class.forName("com.mysql.jdbc.Driver");
             System.out.print("Driver JDBC chargé");
         }
         catch (ClassNotFoundException e) {
             System.out.print(e.toString());
         }
     }
     
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        
        mailF=request.getParameter("mail");
        logicielF=request.getParameter("logiciel");
        systemeF=request.getParameter("systeme");
        problemeF=request.getParameter("probleme");
        System.out.print(" mailF ==" + mailF);
        try{
            Connection con=DriverManager.getConnection(protocol,userName,password);
            //System.out.println("got connection");
            //initialisation de la session
            HttpSession session=request.getSession(true);
            session.setAttribute("mail",new String(mailF));
            session.setAttribute("logiciel",new String(logicielF));
            session.setAttribute("systeme",new String(systemeF));
            session.setAttribute("probleme",new String(problemeF));
            
            Statement s=con.createStatement();
            
            String sql="select mail from user where mail='"+mailF+"'"; 
                System.out.println(sql);
                Statement req=con.createStatement();;
                ResultSet result=req.executeQuery(sql);
                if (result.next())
                {
                    //System.out.println("Ok , je t'ai trouve");
                    response.sendRedirect("/ProjetIteration/ReponseServlet");
                    //getServletContext().getRequestDispatcher("/ProjetIteration/ReponseServlet").forward(request,response);
                }
                else
                {
                    //System.out.println("Le profile n'existe pas");
                    response.sendRedirect("/ProjetIteration/register.html");
                    //getServletContext().getRequestDispatcher("/ProjetIteration/register.html").forward(request, response);
                }
                req.close();
                con.close();
        }
        catch(SQLException e){
            String message="Error."+e.toString();
        }
    }
}

Le formulaire qui appelle le servlet
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Site de maintenance -</title>
<style type="text/css">
    #formulaire {
    border-width:thin;
    width:80%;
    border:1px dashed red;
    padding-right:20px;
    background-color :#FFF;
    
    }
    h1{
    margin:0 0 0 50px;
    color:gray;
    font:arial;
    }
    h2{
    color:green;
    }
</style>
</head>
<body><center>

<form action="/ProjetIteration1/TechSupportServlet" method="post" ><br>
<div id="formulaire">
<h1>Support technique</h1>
<br><br />
<table style="width:700px;">
<tr>
    <td ALIGN="right">Email :</td>
    <td><input type='text'name="mail" ALIGN="left" size="30"/></td>
</tr>
<tr>
    <td ALIGN="right">Logiciel : </td>
    <td><select name='logiciel'>
                <option value='excel'>Microsoft Excel</option>
                <option value='word'>Microsoft Word</option>
                <option value='powerpoint'>Microsoft PowerPoint</option>
            </select></td>
    <td ALIGN="right">Systeme d'exploitation : </td>
    <td><select name='os' size="1">
                    <option value='linux'>Linux</option>
                    <option value='windows'>Windows XP</option>
                    <option value="MacOS">Mac Os</option>
                </select></td>
</tr>
</table> 
<h2>
Description du probleme : <br>
<textarea name="probleme" cols="50" rows="10" wrap="virtual"></textarea><br>
</h2>
<input type="submit" value="Soumettre la requete" /><br><br>
</div>
</form> 
</body>
</html>

Par ailleurs la console ne pose pas de warning ou exception...
INFO: Server startup in 1506 ms
Driver JDBC chargé mailF ==DDDDDD@gmail.com17 déc. 2007 18:26:57 org.apache.catalina.core.StandardContext reload
INFO: Le rechargement de ce contexte a démarré
Driver JDBC chargé mailF ==DSQSDQSD@gmail.com
Merci de votre patiente.