X-Git-Url: https://git.piment-noir.org/?p=TD_webapps.git;a=blobdiff_plain;f=ROOT%2Fexo7%2Fsetcookie.jsp;fp=ROOT%2Fexo7%2Fsetcookie.jsp;h=43ffe8db44d62f7bf742de99ac14e2eba0ef2f7f;hp=0000000000000000000000000000000000000000;hb=27e8c3cf51769dd944bc3d49a5c5776bfcb8aa65;hpb=c69eb3b16833513b2109b19c2e3dfbb66550ef19 diff --git a/ROOT/exo7/setcookie.jsp b/ROOT/exo7/setcookie.jsp new file mode 100644 index 0000000..43ffe8d --- /dev/null +++ b/ROOT/exo7/setcookie.jsp @@ -0,0 +1,16 @@ +<%@ page import="java.io.*, java.util.*, javax.servlet.*" %> +<% +String firstname = request.getParameter("firstname"); +String lastname = request.getParameter("lastname"); +String username = firstname + lastname; +Date timestamp = new Date(); +Cookie cookie = new Cookie("username", username); +cookie.setMaxAge(60*60*24); //24 hours +response.addCookie(cookie); +%> + + + + Continue + +