the user have to type the link /creationClient to see the creation form put the informations and with my servlet i take those informations check them and forward the user to another page to show the informations he's putted. the problem is with my doGet method. here is the code.
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//processRequest(request, response);
this.getServletContext().getRequestDispatcher("/CreerClient.jsp").forward(request, response);
String nom= request.getParameter("nomClient");
String prenom = request.getParameter("prenomClient");
String adresse = request.getParameter("adresseClient");
String telephone= request.getParameter("telephoneClient");
String email= request.getParameter("emailClient");
String message;
if(nom.trim().isEmpty() || telephone.trim().isEmpty() || adresse.trim().isEmpty()){
message= "Erreur, Remplissez tous les champs obligatoires.</br> <a href=\"CreerClient.jsp\" Retour au formulaire de creation d'un Client";
}else
{
message="Creation résussie!";
}
Client client = new Client();
client.setNom(nom);
client.setPrenom(prenom);
client.setAdresse(adresse);
client.setTelephone(telephone);
client.setEmail(email);
request.setAttribute("client", client);
request.setAttribute("message", message);
this.getServletContext().getRequestDispatcher("AfficherClient.jsp").forward(request, response);
}