From fec30b826c6915a3300b782d206467b02a43388a Mon Sep 17 00:00:00 2001 From: "flavien.ancel@pm.me" Date: Thu, 3 Aug 2023 00:49:31 +0200 Subject: [PATCH] ~ Moved CT parameters validation in servlet --- src/main/java/fr/sixthemes/CreateCTHandler.java | 11 +++++++++++ src/main/webapp/WEB-INF/createct.jsp | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/sixthemes/CreateCTHandler.java b/src/main/java/fr/sixthemes/CreateCTHandler.java index 9c372de..d49b808 100644 --- a/src/main/java/fr/sixthemes/CreateCTHandler.java +++ b/src/main/java/fr/sixthemes/CreateCTHandler.java @@ -18,6 +18,17 @@ public class CreateCTHandler extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + + String hostname = !req.getParameter("hostname").equals("") ? req.getParameter("hostname") : "default-hostname"; + String cores = !req.getParameter("cores").equals("") ? req.getParameter("cores") : "2"; + String ram = !req.getParameter("ram").equals("") ? req.getParameter("ram") : "1024"; + String disk = !req.getParameter("disk").equals("") ? req.getParameter("disk") : "16"; + + req.setAttribute("hostname", hostname); + req.setAttribute("cores", cores); + req.setAttribute("ram", ram); + req.setAttribute("disk", disk); + this.getServletContext().getRequestDispatcher("/WEB-INF/createct.jsp").forward(req, resp); } diff --git a/src/main/webapp/WEB-INF/createct.jsp b/src/main/webapp/WEB-INF/createct.jsp index 06b6f0e..1a8a1af 100644 --- a/src/main/webapp/WEB-INF/createct.jsp +++ b/src/main/webapp/WEB-INF/createct.jsp @@ -12,10 +12,10 @@

6-Deploy

CT creation