fin chap9

This commit is contained in:
sio 2024-10-14 16:52:42 +02:00
parent 2fe537045d
commit d7334787cd
6 changed files with 465 additions and 466 deletions

View File

@ -36,7 +36,7 @@ j2ee.compile.on.save=true
j2ee.copy.static.files.on.save=true
j2ee.deploy.on.save=true
j2ee.platform=10-web
j2ee.platform.classpath=${j2ee.server.home}/bin/tomcat-juli.jar:${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-ssi.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.27.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jakartaee-migration-1.0.8-shaded.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jaspic-api.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote-ffm.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-cs.jar:${j2ee.server.home}/lib/tomcat-i18n-de.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-i18n-ko.jar:${j2ee.server.home}/lib/tomcat-i18n-pt-BR.jar:${j2ee.server.home}/lib/tomcat-i18n-ru.jar:${j2ee.server.home}/lib/tomcat-i18n-zh-CN.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar:${j2ee.server.home}/lib/websocket-client-api.jar
j2ee.platform.classpath=${j2ee.server.home}/bin/tomcat-juli.jar:${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-ssi.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.27.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jakartaee-migration-1.0.8-shaded.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jaspic-api.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/mysql-connector-java-8.0.23.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote-ffm.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-cs.jar:${j2ee.server.home}/lib/tomcat-i18n-de.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-i18n-ko.jar:${j2ee.server.home}/lib/tomcat-i18n-pt-BR.jar:${j2ee.server.home}/lib/tomcat-i18n-ru.jar:${j2ee.server.home}/lib/tomcat-i18n-zh-CN.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar:${j2ee.server.home}/lib/websocket-client-api.jar
j2ee.server.type=Tomcat
jar.compress=false
javac.classpath=\

View File

@ -16,14 +16,14 @@ import java.sql.SQLException;
* @author sio
*/
public class ClientMySQL {
/*Connexion MV serveurBD lycée
private final Connection laConnection = Connexion.getConnect("10.121.38.165", "bdclient", "adminBDClient", "mdpBDClient");*/
//Connexion MV serveurBD lycée
private final Connection laConnection = Connexion.getConnect("10.121.38.106", "bdclient", "adminBDClient", "mdpBDClient");
/*Connexion wampserver
private final Connection laConnection = Connexion.getConnect("localhost", "bdclient", "adminBDClient", "mdpBDClient");*/
//connexion MV serveurBD maison
private final Connection laConnection = Connexion.getConnect("192.168.1.21", "bdclient", "adminBDClient", "mdpBDClient");
//private final Connection laConnection = Connexion.getConnect("192.168.1.21", "bdclient", "adminBDClient", "mdpBDClient");
public int create(Client c){
int id=-1;

View File

@ -17,14 +17,14 @@ import javabeans.User;
* @author sio
*/
public class SalarieMySQL {
/*Connexion MV serveurBD lycée
private final Connection laConnection = Connexion.getConnect("10.121.38.165", "bdclient", "adminBDClient", "mdpBDClient");*/
//Connexion MV serveurBD lycée
private final Connection laConnection = Connexion.getConnect("10.121.38.106", "bdclient", "adminBDClient", "mdpBDClient");
/*Connexion wampserver
private final Connection laConnection = Connexion.getConnect("localhost", "bdclient", "adminBDClient", "mdpBDClient");*/
//connexion MV serveurBD maison
private final Connection laConnection = Connexion.getConnect("192.168.1.21", "bdclient", "adminBDClient", "mdpBDClient");
// private final Connection laConnection = Connexion.getConnect("192.168.1.21", "bdclient", "adminBDClient", "mdpBDClient");

View File

@ -60,8 +60,7 @@ public class ListeServlet2 extends HttpServlet {
throws ServletException, IOException {
System.out.println("ListeServlet2");
ClientMySQL cli = new ClientMySQL();
//envoyer à la vue la liste des clients
request.setAttribute("laListe", cli.readAll());
getServletContext().getRequestDispatcher("/WEB-INF/listeClientsVue.jsp").forward(request, response);
}

View File

@ -73,28 +73,28 @@ public class NouveauServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//processRequest(request, response);
// 1, Récupération de la session
HttpSession maSession = request.getSession();
//Création de l'objet leControl de type AuthentifForm
NouveauClientForm leControle = new NouveauClientForm();
//Appel de la méthode controlerAdmin
//Appel de la méthode créer le client dans la BD
int isNum=leControle.verifierClient(request);
//création de 2 attributs de requête (isAdmin et leControle)
request.setAttribute("controlForm", leControle);
request.setAttribute("isNumAjoute", isNum);
//gestion de la liste des clients créés
if (isNum != -1) {
// Ajout du no du client créé, dans une collection dentiers stockée en session
// 1, Récupération de la session
HttpSession maSession = request.getSession();
// 2. Récupération de la collection des clients si elle existe, création sinon
ArrayList<Integer> lesNouveauxClients = (ArrayList<Integer>) maSession.getAttribute("lesNvxClients");
if (lesNouveauxClients == null) {
lesNouveauxClients = new ArrayList<>();
// Ajout du no du client créé, dans une collection dentiers stockée en session
// 2. Récupération de la collection des clients si elle existe, création sinon
ArrayList<Integer> lesNouveauxClients = (ArrayList<Integer>) maSession.getAttribute("lesNvxClients");
if (lesNouveauxClients == null) {
lesNouveauxClients = new ArrayList<>();
}
// 3. Ajout du no du client créé dans la collection
lesNouveauxClients.add(isNum);
// 4. Mise à jour de la session
maSession.setAttribute("lesNvxClients", lesNouveauxClients);
}
// 3. Ajout du no du client créé dans la collection
lesNouveauxClients.add(isNum);
// 4. Mise à jour de la session
maSession.setAttribute("lesNvxClients", lesNouveauxClients); }
//Affichage JSP, redirection couche vue
getServletContext().getRequestDispatcher("/WEB-INF/nouveauClientVue.jsp").forward(request, response);
}

View File

@ -13,12 +13,12 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Liste des clients</title>
</head>
<body>
<%@include file="jspf/enteteClient.jspf" %>
<%@include file="jspf/menuClient.jspf" %>
<h2>Liste des clients</h2>
<%--Affichage de la vue--%>
<c:out value="${laListe}" default="La liste doit être là" />
</body>
</html>