exo7: fix to the form cinematic.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 10 Apr 2018 14:41:06 +0000 (16:41 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 10 Apr 2018 14:41:06 +0000 (16:41 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
ROOT/exo7/form.jsp
ROOT/exo7/nextpage.jsp
ROOT/exo7/saveinfos.jsp [new file with mode: 0644]
ROOT/exo7/savename.jsp [deleted file]

index 9b620a8a4b10ae4b181c3ddaa6feb837c17ef4ec..96c73e61c13e0b5beb45e42fa5d13618c6ee03d6 100644 (file)
@@ -1,11 +1,17 @@
 <html>
 <body>
 
-<form action="savename.jsp">
+<form action="saveinfos.jsp">
   First name:<br>
   <input type="text" name="firstname"><br>
   Last name:<br>
-  <input type="text" name="lastname"><br><br>
+  <input type="text" name="lastname"><br>
+  Address:<br>
+  <input type="text" name="address"><br>
+  Age:<br>
+  <input type="text" name="age" size="3"><br>
+  Work:<br>
+  <input type="text" name="work"><br><br>
   <input type="submit" value="Submit">
 </form>
 
index 862741423411db6fbf625e344646e4bba74c77a8..37153a64a120fe0652bc917785449d675ea0d848 100644 (file)
@@ -1,5 +1,6 @@
 <html>
     <body>
-        Bonjour <%= session.getAttribute("theName") %>
+        Bonjour <% out.print(session.getAttribute("firstname")); %> <% out.print(session.getAttribute("lastname")); %>, <% out.print(session.getAttribute("age")); %> years old
+        living at <% out.print(session.getAttribute("address")); %> working as <% out.print(session.getAttribute("work")); %>
     </body>
 </html>
diff --git a/ROOT/exo7/saveinfos.jsp b/ROOT/exo7/saveinfos.jsp
new file mode 100644 (file)
index 0000000..11b0f65
--- /dev/null
@@ -0,0 +1,18 @@
+<%
+String firstname = request.getParameter("firstname");
+String lastname = request.getParameter("lastname");
+String address = request.getParameter("address");
+String age = request.getParameter("age");
+String work = request.getParameter("work");
+session.setAttribute("firstname", firstname);
+session.setAttribute("lastname", lastname);
+session.setAttribute("address", address);
+session.setAttribute("age", age);
+session.setAttribute("work", work);
+%>
+
+<html>
+    <body>
+        <a href="nextpage.jsp">Continue</a>
+    </body>
+</html>
diff --git a/ROOT/exo7/savename.jsp b/ROOT/exo7/savename.jsp
deleted file mode 100644 (file)
index b790925..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<%
-String firstname = request.getParameter("firstname");
-String lastname = request.getParameter("lastname");
-session.setAttribute("theName", firstname + " " + lastname);
-%>
-
-<html>
-    <body>
-        <a href="nextpage.jsp">Continue</a>
-    </body>
-</html>