From f8c6f584ba57cb11f1f089f9ef6fb0a45270fcd2 Mon Sep 17 00:00:00 2001 From: "ilona.cardot" Date: Thu, 3 Oct 2024 11:47:26 +0200 Subject: [PATCH] ajout dossier jakarta ee --- build.xml | 71 + nbproject/ant-deploy.xml | 69 + nbproject/build-impl.xml | 1432 ++++++++++++++++++ nbproject/genfiles.properties | 8 + nbproject/project.properties | 86 ++ nbproject/project.xml | 27 + src/conf/MANIFEST.MF | 2 + src/java/gestionClient/AccueilServlet.java | 86 ++ src/java/gestionClient/AuthentifServlet.java | 90 ++ src/java/gestionClient/ListeServlet2.java | 87 ++ src/java/gestionClient/NouveauServlet.java | 85 ++ src/java/javabeans/User.java | 66 + src/java/testForms/AuthentifForm.java | 33 + web/META-INF/context.xml | 2 + web/WEB-INF/accueilVue.jsp | 43 + web/WEB-INF/jspf/enteteClient.jspf | 3 + web/WEB-INF/jspf/menuClient.jspf | 10 + web/WEB-INF/listeClientsVue.jsp | 21 + web/WEB-INF/nouveauClientVue.jsp | 21 + web/WEB-INF/web.xml | 35 + web/index.html | 15 + 21 files changed, 2292 insertions(+) create mode 100644 build.xml create mode 100644 nbproject/ant-deploy.xml create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/conf/MANIFEST.MF create mode 100644 src/java/gestionClient/AccueilServlet.java create mode 100644 src/java/gestionClient/AuthentifServlet.java create mode 100644 src/java/gestionClient/ListeServlet2.java create mode 100644 src/java/gestionClient/NouveauServlet.java create mode 100644 src/java/javabeans/User.java create mode 100644 src/java/testForms/AuthentifForm.java create mode 100644 web/META-INF/context.xml create mode 100644 web/WEB-INF/accueilVue.jsp create mode 100644 web/WEB-INF/jspf/enteteClient.jspf create mode 100644 web/WEB-INF/jspf/menuClient.jspf create mode 100644 web/WEB-INF/listeClientsVue.jsp create mode 100644 web/WEB-INF/nouveauClientVue.jsp create mode 100644 web/WEB-INF/web.xml create mode 100644 web/index.html diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..99ca92f --- /dev/null +++ b/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project Test2JakartaV6. + + + diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml new file mode 100644 index 0000000..785fa0b --- /dev/null +++ b/nbproject/ant-deploy.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..de3c764 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1432 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..97db6ed --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=10ef9256 +build.xml.script.CRC32=075741f5 +build.xml.stylesheet.CRC32=1707db4f@1.98.0.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=10ef9256 +nbproject/build-impl.xml.script.CRC32=335cc129 +nbproject/build-impl.xml.stylesheet.CRC32=334708a0@1.98.0.1 diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..f27dd97 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,86 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +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= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath= +excludes= +file.reference.jakarta.servlet.jsp.jstl-2.0.0.jar=C:\\Users\\ilona.cardot\\Documents\\java libraries\\jakarta.servlet.jsp.jstl-2.0.0.jar +file.reference.jakarta.servlet.jsp.jstl-api-2.0.0.jar=C:\\Users\\ilona.cardot\\Documents\\java libraries\\jakarta.servlet.jsp.jstl-api-2.0.0.jar +includes=** +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.server.type=Tomcat +jar.compress=false +javac.classpath=\ + ${file.reference.jakarta.servlet.jsp.jstl-2.0.0.jar}:\ + ${file.reference.jakarta.servlet.jsp.jstl-api-2.0.0.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=21 +javac.target=21 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +persistence.xml.dir=${conf.dir} +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=Test2JakartaV6.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..b9baba6 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,27 @@ + + + org.netbeans.modules.web.project + + + Test2JakartaV6 + 1.6.5 + + + ${file.reference.jakarta.servlet.jsp.jstl-2.0.0.jar} + WEB-INF/lib + + + ${file.reference.jakarta.servlet.jsp.jstl-api-2.0.0.jar} + WEB-INF/lib + + + + + + + + + + + + diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/src/java/gestionClient/AccueilServlet.java b/src/java/gestionClient/AccueilServlet.java new file mode 100644 index 0000000..e095e91 --- /dev/null +++ b/src/java/gestionClient/AccueilServlet.java @@ -0,0 +1,86 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package gestionClient; + +import java.io.IOException; +import java.io.PrintWriter; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * + * @author famille Thevenot + */ +public class AccueilServlet extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * 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(""); + out.println(""); + out.println(""); + out.println("Servlet AccueilServlet"); + out.println(""); + out.println(""); + out.println("

Servlet AccueilServlet at " + request.getContextPath() + "

"); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP GET 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/accueilVue.jsp").forward(request, response); + } + + /** + * Handles the HTTP POST 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"; + }// + +} diff --git a/src/java/gestionClient/AuthentifServlet.java b/src/java/gestionClient/AuthentifServlet.java new file mode 100644 index 0000000..5c1a951 --- /dev/null +++ b/src/java/gestionClient/AuthentifServlet.java @@ -0,0 +1,90 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package gestionClient; + +import java.io.IOException; +import java.io.PrintWriter; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import testForms.AuthentifForm; + +/** + * + * @author famille Thevenot + */ +public class AuthentifServlet extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * 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(""); + out.println(""); + out.println(""); + out.println("Servlet AuthentifServlet"); + out.println(""); + out.println(""); + out.println("

Servlet AuthentifServlet at " + request.getContextPath() + "

"); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP GET 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 POST 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); + AuthentifForm leControle = new AuthentifForm(); + Boolean result=leControle.controlerAdmin(request); + request.setAttribute("controlForm", result); + getServletContext().getRequestDispatcher("/WEB-INF/accueilVue.jsp").forward(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/src/java/gestionClient/ListeServlet2.java b/src/java/gestionClient/ListeServlet2.java new file mode 100644 index 0000000..d3db7cc --- /dev/null +++ b/src/java/gestionClient/ListeServlet2.java @@ -0,0 +1,87 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package gestionClient; + +import java.io.IOException; +import java.io.PrintWriter; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * + * @author famille Thevenot + */ +@WebServlet(name = "ListeServlet2", urlPatterns = {"/ListeClients"}) +public class ListeServlet2 extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * 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(""); + out.println(""); + out.println(""); + out.println("Servlet ListeServlet2"); + out.println(""); + out.println(""); + out.println("

Servlet ListeServlet2 at " + request.getContextPath() + "

"); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP GET 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 { + getServletContext().getRequestDispatcher("/WEB-INF/listeClientsVue.jsp").forward(request, response); + } + + /** + * Handles the HTTP POST 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"; + }// + +} diff --git a/src/java/gestionClient/NouveauServlet.java b/src/java/gestionClient/NouveauServlet.java new file mode 100644 index 0000000..dccea91 --- /dev/null +++ b/src/java/gestionClient/NouveauServlet.java @@ -0,0 +1,85 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package gestionClient; + +import java.io.IOException; +import java.io.PrintWriter; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * + * @author famille Thevenot + */ +public class NouveauServlet extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * 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(""); + out.println(""); + out.println(""); + out.println("Servlet NouveauServlet"); + out.println(""); + out.println(""); + out.println("

Servlet NouveauServlet at " + request.getContextPath() + "

"); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP GET 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 { + getServletContext().getRequestDispatcher("/WEB-INF/nouveauClientVue.jsp").forward(request, response); + } + + /** + * Handles the HTTP POST 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"; + }// + +} diff --git a/src/java/javabeans/User.java b/src/java/javabeans/User.java new file mode 100644 index 0000000..9bf6d95 --- /dev/null +++ b/src/java/javabeans/User.java @@ -0,0 +1,66 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package javabeans; + +import java.util.Objects; + +/** + * + * @author famille Thevenot + */ +public class User { + private String pseudo; + private String motDePasse; + + public User(String pseudo, String motDePasse) { + this.pseudo = pseudo; + this.motDePasse = motDePasse; + } + + public User(String header) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + public String getPseudo() { + return pseudo; + } + + public void setPseudo(String pseudo) { + this.pseudo = pseudo; + } + + public String getMotDePasse() { + return motDePasse; + } + + public void setMotDePasse(String motDePasse) { + this.motDePasse = motDePasse; + } + + @Override + public int hashCode() { + int hash = 5; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final User other = (User) obj; + if (!Objects.equals(this.pseudo, other.pseudo)) { + return false; + } + return Objects.equals(this.motDePasse, other.motDePasse); + } + +} diff --git a/src/java/testForms/AuthentifForm.java b/src/java/testForms/AuthentifForm.java new file mode 100644 index 0000000..e482175 --- /dev/null +++ b/src/java/testForms/AuthentifForm.java @@ -0,0 +1,33 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package testForms; + +import jakarta.servlet.http.HttpServletRequest; +import javabeans.User; + +/** + * + * @author famille Thevenot + */ +public class AuthentifForm { + private String resultat; + + public String getResultat() { + return resultat; + } + + public void setResultat(String resultat) { + this.resultat = resultat; + } + + public boolean controlerAdmin(HttpServletRequest request) + { + User admin = new User("admin", "minda"); + User userSaisi = new User(request.getParameter("ztPseudo"),request.getParameter("ztMDP")); + return admin.equals(userSaisi); + } + + +} diff --git a/web/META-INF/context.xml b/web/META-INF/context.xml new file mode 100644 index 0000000..670b137 --- /dev/null +++ b/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/web/WEB-INF/accueilVue.jsp b/web/WEB-INF/accueilVue.jsp new file mode 100644 index 0000000..316d921 --- /dev/null +++ b/web/WEB-INF/accueilVue.jsp @@ -0,0 +1,43 @@ +<%-- + Document : accueilJSP + Created on : 9 sept. 2024, 12:32:01 + Author : famille Thevenot +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + + Accueil des clients + + + <%@include file="jspf/enteteClient.jspf" %> + <%@include file="jspf/menuClient.jspf" %> + +

Bienvenue sur la nouvelle application de gestion des clients écrites avec JakartaEE

+ ${empty param.ztPseudo ? "Veuillez-vous authentifier." : "Authentification réussie.
"} + + + +

Bienvenue : ${param.ztPseudo}

+
+ +

Bienvenue : ${param.ztPseudo}.
Vous êtes l'administrateur

+
+
+ + +
+ +

+ +

+ +
+ + + + diff --git a/web/WEB-INF/jspf/enteteClient.jspf b/web/WEB-INF/jspf/enteteClient.jspf new file mode 100644 index 0000000..8d9d23f --- /dev/null +++ b/web/WEB-INF/jspf/enteteClient.jspf @@ -0,0 +1,3 @@ +<%-- any content can be specified here e.g.: --%> +<%@ page pageEncoding="UTF-8" %> +

Gestion des clients

diff --git a/web/WEB-INF/jspf/menuClient.jspf b/web/WEB-INF/jspf/menuClient.jspf new file mode 100644 index 0000000..9727cd9 --- /dev/null +++ b/web/WEB-INF/jspf/menuClient.jspf @@ -0,0 +1,10 @@ +<%-- any content can be specified here e.g.: --%> +<%@ page pageEncoding="UTF-8" %> + + diff --git a/web/WEB-INF/listeClientsVue.jsp b/web/WEB-INF/listeClientsVue.jsp new file mode 100644 index 0000000..fa67aa7 --- /dev/null +++ b/web/WEB-INF/listeClientsVue.jsp @@ -0,0 +1,21 @@ +<%-- + Document : listeClientsVue + Created on : 15 sept. 2024, 18:51:03 + Author : famille Thevenot +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Liste des clients + + + <%@include file="jspf/enteteClient.jspf" %> + <%@include file="jspf/menuClient.jspf" %> +

Liste des clients

+

Page en construction

+ + diff --git a/web/WEB-INF/nouveauClientVue.jsp b/web/WEB-INF/nouveauClientVue.jsp new file mode 100644 index 0000000..7399f4c --- /dev/null +++ b/web/WEB-INF/nouveauClientVue.jsp @@ -0,0 +1,21 @@ +<%-- + Document : nouveauClientVue + Created on : 15 sept. 2024, 18:49:28 + Author : famille Thevenot +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Nouveau client + + + <%@include file="jspf/enteteClient.jspf" %> + <%@include file="jspf/menuClient.jspf" %> +

Nouveau client

+

Page en construction

+ + diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml new file mode 100644 index 0000000..1c86eed --- /dev/null +++ b/web/WEB-INF/web.xml @@ -0,0 +1,35 @@ + + + + ListeServlet + ListeServlet2 + + + AccueilServlet + gestionClient.AccueilServlet + + + NouveauServlet + gestionClient.NouveauServlet + + + AuthentifServlet + gestionClient.AuthentifServlet + + + ListeServlet2 + /listeClients + + + AccueilServlet + / + + + NouveauServlet + /nouveauClient + + + AuthentifServlet + /authentification + + diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..4cea0a0 --- /dev/null +++ b/web/index.html @@ -0,0 +1,15 @@ + + + + + TODO supply a title + + + + +
TODO write content
+ +