diff --git a/src/java/bdd/PompierMySql.java b/src/java/bdd/PompierMySql.java index 30e46c9..6ec6945 100644 --- a/src/java/bdd/PompierMySql.java +++ b/src/java/bdd/PompierMySql.java @@ -173,20 +173,31 @@ public class PompierMySql { String mdp = request.getParameter("ztMDP"); String mdpChiffre = MD5.encode(request.getParameter("ztMDP")); String sql = "SELECT * FROM pompier WHERE login='" + login + "' AND mdp='" + mdpChiffre + "';"; - System.out.println("sql:"+sql); + System.out.println("sql:" + sql); try { Statement stmt = theConnection.createStatement(); ResultSet resultQ = null; resultQ = stmt.executeQuery(sql); resultat = (resultQ.next()); - if(resultat){ + if (resultat) { Pompier lePompier = new Pompier( - resultQ.getInt("id"), + resultQ.getInt("id"), resultQ.getInt("idCAserne"), - + resultQ.getString("nom"), + resultQ.getString("prenom"), + resultQ.getInt("statut"), + resultQ.getString("mail"), + resultQ.getString("login"), + resultQ.getString("mdp"), + resultQ.getInt("adrNo"), + resultQ.getString("adrRue"), + resultQ.getString("adrCP"), + resultQ.getString("adrVille"), + resultQ.getInt("grade"), + resultQ.getString("commentaire") ); HttpSession maSession = request.getSession(); - maSession.setAttribute("lePompier", lePompier); + maSession.setAttribute("lePompier", lePompier); } } catch (SQLException ex) { diff --git a/src/java/com/test/forms/NouveauPompForm.java b/src/java/com/test/forms/NouveauPompForm.java index 0c96ab2..b21a715 100644 --- a/src/java/com/test/forms/NouveauPompForm.java +++ b/src/java/com/test/forms/NouveauPompForm.java @@ -47,19 +47,20 @@ public class NouveauPompForm { // Creation d'un objet de type Client avec les données transmises - Pompier unPompier = new Pompier(request.getParameter("id"), + Pompier unPompier = new Pompier( + request.getParameter("id"), request.getParameter("idCaserne"), - request.getParameter("ztNom"), - request.getParameter("ztPrenom"), - request.getParameter("nStatut"), - request.getParameter("eMail"), - request.getParameter("ztLogin"), - request.getParameter("ztMDP"), + request.getParameter("nom"), + request.getParameter("prenom"), + request.getParameter("statut"), + request.getParameter("mail"), + request.getParameter("login"), + request.getParameter("mdp"), noRue, - request.getParameter("ztAdrRue"), - request.getParameter("ztAdrCP"), - request.getParameter("ztAdrVille"), - request.getParameter("nGrade"), + request.getParameter("adrRue"), + request.getParameter("adrCP"), + request.getParameter("adrVille"), + request.getParameter("grade"), request.getParameter("commentaire") ); PompierMySql cm = new PompierMySql(); diff --git a/src/java/com/test/servlets/authentifServlet.java b/src/java/com/test/servlets/authentifServlet.java index 6439bf6..5418849 100644 --- a/src/java/com/test/servlets/authentifServlet.java +++ b/src/java/com/test/servlets/authentifServlet.java @@ -79,11 +79,12 @@ public class authentifServlet extends HttpServlet { AuthentifForm leControle = new AuthentifForm(); // Appel de la méthode controlerRole boolean isAuthentified = leControle.controlerRole(request); - // Création de 2 attributs de requête (isChef et leControle) + // Création de 2 attributs de requête (isAuthentified et leControle) request.setAttribute("isAuthentified", isAuthentified); request.setAttribute("controlForm", leControle); HttpSession maSession = request.getSession(); maSession.setAttribute("isAuthentified", true); + // Affichage de la JSP if(isAuthentified==true){ getServletContext().getRequestDispatcher("/WEB-INF/PompierJSP.jsp")