1 <%@ page import="java.io.*, java.util.*, javax.servlet.*" %>
3 request.setCharacterEncoding("UTF-8");
4 String firstname = request.getParameter("firstname");
5 String lastname = request.getParameter("lastname");
6 String username = firstname + lastname;
7 Date timestamp = new Date();
8 Cookie cookie = new Cookie("username", username);
9 cookie.setMaxAge(60*60*24); //24 hours
10 response.addCookie(cookie);
15 <a href="viewcookie.jsp">Continue</a>