Example of import Attribute
(Continued)
<%
Cookie[] cookies = request.getCookies();
String oldID =
ServletUtilities
.getCookieValue(cookies, "userID",
NO_VALUE);
String newID;
if (oldID.equals(NO_VALUE)) {
newID = randomID();
} else {
newID = oldID;
}
LongLivedCookie cookie =
new LongLivedCookie("userID", newID);
response.addCookie(cookie);
%>
<% JSP Expressions %>
This page was accessed at <%=
new Date()
%> with a userID
cookie of <%= oldID %>.