Merge origin/master
Conflicts: web/WEB-INF/ChefCaserneJSP.jsp web/WEB-INF/ModifPompier.jsp web/WEB-INF/jspf/enteteJSPF.jspf
This commit is contained in:
commit
99b4e221cc
@ -12,7 +12,7 @@ build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
build.web.dir=${build.dir}/web
|
||||
build.web.excludes=${build.classes.excludes}
|
||||
client.urlPart=
|
||||
client.urlPart=/Authentification
|
||||
compile.jsps=false
|
||||
conf.dir=${source.root}/conf
|
||||
debug.classpath=${build.classes.dir}:${javac.classpath}
|
||||
|
@ -46,7 +46,7 @@ public class NouveauPompForm {
|
||||
if (erreur > 0) return -1;
|
||||
|
||||
// Creation d'un objet de type Client avec les données transmises
|
||||
// String mdpChiffre = MD5.encode(request.getParameter("ztMDP"));
|
||||
String mdpChiffre = MD5.encode(request.getParameter("ztMDP"));
|
||||
Pompier unPompier = new Pompier(request.getParameter("id"),
|
||||
request.getParameter("idCaserne"),
|
||||
request.getParameter("ztNom"),
|
||||
|
106
src/java/com/test/servlets/CreaPompierServlet.java
Normal file
106
src/java/com/test/servlets/CreaPompierServlet.java
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.test.servlets;
|
||||
|
||||
import com.test.forms.NouveauPompForm;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clementine.desrucques
|
||||
*/
|
||||
public class CreaPompierServlet extends HttpServlet {
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
try ( PrintWriter out = response.getWriter()) {
|
||||
/* TODO output your page here. You may use following sample code. */
|
||||
out.println("<!DOCTYPE html>");
|
||||
out.println("<html>");
|
||||
out.println("<head>");
|
||||
out.println("<title>Servlet CreaPompierServlet</title>");
|
||||
out.println("</head>");
|
||||
out.println("<body>");
|
||||
out.println("<h1>Servlet CreaPompierServlet at " + request.getContextPath() + "</h1>");
|
||||
out.println("</body>");
|
||||
out.println("</html>");
|
||||
}
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
// processRequest(request, response);
|
||||
getServletContext().getRequestDispatcher("/WEB-INF/CreaPompier.jsp").forward(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
NouveauPompForm nvp = new NouveauPompForm();
|
||||
int idPomp = nvp.verifNouveauPompier(request);
|
||||
request.setAttribute("idPompier", idPomp);
|
||||
request.setAttribute("message", nvp.getMessage());
|
||||
|
||||
if (idPomp != -1){
|
||||
HttpSession maSession = request.getSession();
|
||||
ArrayList<Integer> lesNouveauxPompiers = (ArrayList<Integer>) maSession.getAttribute("lesNvxPompiers");
|
||||
if (lesNouveauxPompiers == null){
|
||||
lesNouveauxPompiers = new ArrayList<>();
|
||||
}
|
||||
lesNouveauxPompiers.add(idPomp);
|
||||
maSession.setAttribute("lesNvxPompiers", lesNouveauxPompiers);
|
||||
}
|
||||
|
||||
getServletContext().getRequestDispatcher("/WEB-INF/CreaPompier.jsp").forward(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
87
src/java/com/test/servlets/ModifPompierServlet.java
Normal file
87
src/java/com/test/servlets/ModifPompierServlet.java
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.test.servlets;
|
||||
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clementine.desrucques
|
||||
*/
|
||||
public class ModifPompierServlet extends HttpServlet {
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
try ( PrintWriter out = response.getWriter()) {
|
||||
/* TODO output your page here. You may use following sample code. */
|
||||
out.println("<!DOCTYPE html>");
|
||||
out.println("<html>");
|
||||
out.println("<head>");
|
||||
out.println("<title>Servlet ModifPompierServlet</title>");
|
||||
out.println("</head>");
|
||||
out.println("<body>");
|
||||
out.println("<h1>Servlet ModifPompierServlet at " + request.getContextPath() + "</h1>");
|
||||
out.println("</body>");
|
||||
out.println("</html>");
|
||||
}
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@ -77,9 +77,9 @@ public class authentifServlet extends HttpServlet {
|
||||
throws ServletException, IOException {
|
||||
// Création de l'objet leControle de type AuthentifForm
|
||||
AuthentifForm leControle = new AuthentifForm();
|
||||
// Appel de la méthode controlerAdmin
|
||||
// Appel de la méthode controlerRole
|
||||
boolean isChef = leControle.controlerRole(request);
|
||||
// Création de 2 attributs de requête (isAdmin et leControle)
|
||||
// Création de 2 attributs de requête (isChef et leControle)
|
||||
request.setAttribute("isChef", isChef);
|
||||
request.setAttribute("controlForm", leControle);
|
||||
HttpSession maSession = request.getSession();
|
||||
|
36
src/java/util/MD5.java
Normal file
36
src/java/util/MD5.java
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package util;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sio
|
||||
*/
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public abstract class MD5 {
|
||||
|
||||
public static String encode(String uneChaine){
|
||||
MessageDigest md = null;
|
||||
try {
|
||||
md = MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
throw new IllegalArgumentException(ex);
|
||||
}
|
||||
md.update(uneChaine.getBytes());
|
||||
byte[] digest = md.digest();
|
||||
//myHash = DatatypeConverter.printHexBinary(digest).toLowerCase();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : digest) {
|
||||
sb.append(String.format("%02x", b));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -12,6 +12,49 @@
|
||||
<title>Chef de caserne</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>chef caserne</h1>
|
||||
<h1>Les pompiers :</h1>
|
||||
<table border="1" cellspacing="3" cellpadding="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>IdCaserne</th>
|
||||
<th>Nom</th>
|
||||
<th>Prénom</th>
|
||||
<th>Numéro de statut</th>
|
||||
<th>Mail</th>
|
||||
<th>Login</th>
|
||||
<th>Mot de passe</th>
|
||||
<th>No rue</th>
|
||||
<th>Nom rue</th>
|
||||
<th>Code postal</th>
|
||||
<th>Ville</th>
|
||||
<th>Numéro de grade</th>
|
||||
<th>Commentaire</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${lesPompiers}" var="unPompier">
|
||||
<tr>
|
||||
<td><c:out value="${unPompier.getId()}"/></td>
|
||||
<td><c:out value="${unPompier.getIdCaserne()}"/></td>
|
||||
<td><c:out value="${unPompier.getNom()}"/></td>
|
||||
<td><c:out value="${unPompier.getPrenom()}"/></td>
|
||||
<td><c:out value="${unPompier.getStatut()}"/></td>
|
||||
<td><c:out value="${unPompier.getMail()}"/></td>
|
||||
<td><c:out value="${unPompier.getLogin()}"/></td>
|
||||
<td><c:out value="${unPompier.getMdp()}"/></td>
|
||||
<td><c:out value="${unPompier.getAdrNo()}"/></td>
|
||||
<td><c:out value="${unPompier.getAdrRue()}"/></td>
|
||||
<td><c:out value="${unPompier.getAdrCP()}"/></td>
|
||||
<td><c:out value="${unPompier.getAdrVille()}"/></td>
|
||||
<td><c:out value="${unPompier.getGrade()}"/></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<a href="ModifPompier"><input type="button" name="btModifP" value="Modifier la fiche pompier"/></a>
|
||||
<a href="CreaPompier" ><input type="button" name="btNouvP" value="Créer nouveau pompier"/></a>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -9,9 +9,52 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>JSP Page</title>
|
||||
<title>Modification</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>ModifPompier</h1>
|
||||
<h1>Modification des informations :</h1>
|
||||
<fieldset>
|
||||
<legend>Fiche Pompier</legend>
|
||||
<form name="fPompier" method="POST" action="ModifPompier">
|
||||
<label for="nIdCaserne">Id Caserne : </label>
|
||||
<input type="number" name="nIdCaserne"/><br /><br/>
|
||||
<label for="ztNom">Nom : </label>
|
||||
<input type="text" name="ztNom" placeholder="Nom" /><br /><br/>
|
||||
<label for="ztPrenom">Prénom : </label>
|
||||
<input type="text" name="ztPrenom" placeholder="Prénom"/><br /><br/>
|
||||
<label for="nStatut">Numéro de statut : </label>
|
||||
<input type="number" name="nStatut"/><br /><br/>
|
||||
<label for="eMail">Mail : </label>
|
||||
<input type="email" name="eMail"/><br /><br/>
|
||||
<label for="ztLogin">Login : </label>
|
||||
<input type="text" name="ztLogin" placeholder="Login"/><br /><br/>
|
||||
<label for="ztMDP">Mot de passe : </label>
|
||||
<input type="password" name="ztMDP" placeholder="Mot de passe" /><br /><br />
|
||||
<label for="nAdrNo">Numéro de rue : </label>
|
||||
<input type="number" name="nAdrNo"/><br /><br/>
|
||||
<label for="ztAdrRue">Nom de la rue : </label>
|
||||
<input type="text" name="ztAdrRue" placeholder="Rue" /><br /><br/>
|
||||
<label for="ztAdrCP">Code postal : </label>
|
||||
<input type="text" name="ztAdrCP" placeholder="Code postal" /><br /><br/>
|
||||
<label for="ztAdrVille">Ville : </label>
|
||||
<input type="text" name="ztAdrVille" placeholder="Ville" /><br /><br/>
|
||||
<label for="nGrade">Numéro de grade : </label>
|
||||
<input type="number" name="nGrade"/><br /><br/>
|
||||
<input type="submit" value="Valider" />
|
||||
</form>
|
||||
</fieldset>
|
||||
<c:out value="${unClient.getId()}"/></td>
|
||||
<c:out value="${unClient.getCivilite()}"/>
|
||||
<c:out value="${unClient.getNom()}"/>
|
||||
<c:out value="${unClient.getPrenom()}"/>
|
||||
<c:out value="${unClient.getMdp()}"/>
|
||||
<c:out value="${unClient.getAdrNo()}"/>
|
||||
<c:out value="${unClient.getAdrRue()}"/>
|
||||
<c:out value="${unClient.getAdrVille()}"/>
|
||||
<c:out value="${unClient.getAdrCP()}"/>
|
||||
<c:out value="${unClient.getAdrmail()}"/>
|
||||
<c:out value="${unClient.getTel()}"/>
|
||||
<c:out value="${unClient.getDateNais()}"/></td>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%-- any content can be specified here e.g.: --%>
|
||||
<%@ page pageEncoding="UTF-8" %>
|
||||
<h2></h2>
|
||||
<img src="image/SDIS-29.png" alt="alt"/>
|
||||
<p align="center"><img src="image/SDIS-29.png" alt="SDIS 29" /></p>
|
||||
|
@ -12,6 +12,14 @@
|
||||
<servlet-name>authentifServlet</servlet-name>
|
||||
<servlet-class>com.test.servlets.authentifServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>ModifPompierServlet</servlet-name>
|
||||
<servlet-class>com.test.servlets.ModifPompierServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>CreaPompierServlet</servlet-name>
|
||||
<servlet-class>com.test.servlets.CreaPompierServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>PompierServlet</servlet-name>
|
||||
<url-pattern>/Pompier</url-pattern>
|
||||
@ -24,6 +32,14 @@
|
||||
<servlet-name>authentifServlet</servlet-name>
|
||||
<url-pattern>/Authentification</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>ModifPompierServlet</servlet-name>
|
||||
<url-pattern>/ModifPompier</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>CreaPompierServlet</servlet-name>
|
||||
<url-pattern>/CreaPompier</url-pattern>
|
||||
</servlet-mapping>
|
||||
<session-config>
|
||||
<session-timeout>
|
||||
30
|
||||
|
Loading…
x
Reference in New Issue
Block a user