~ Moved CT parameters validation in servlet

main
flavien.ancel@pm.me 1 year ago
parent b9b5621b6c
commit fec30b826c

@ -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);
}

@ -12,10 +12,10 @@
<h1>6-Deploy</h1>
<h2>CT creation</h2>
<ul>
<li><strong>Hostname : </strong><%= request.getParameter("hostname")%></li>
<li><strong>Cores : </strong><%= request.getParameter("cores")%></li>
<li><strong>RAM : </strong><%= request.getParameter("ram")%></li>
<li><strong>Disk (in GB) : </strong><%= request.getParameter("disk")%></li>
<li><strong>Hostname : </strong>${hostname}</li>
<li><strong>Cores : </strong>${cores}</li>
<li><strong>RAM : </strong>${ram}</li>
<li><strong>Disk (in GB) : </strong>${disk}</li>
</ul>
</div>
</body>

Loading…
Cancel
Save