Listing 12 - Listing 12.1 ImportAttribute.jsp <!DOCTYPE...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Listing 12.1 ImportAttribute.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>The import Attribute</TITLE> <LINK REL=STYLESHEET HREF="JSP-Styles.css" TYPE="text/css"> </HEAD> <BODY> <H2>The import Attribute</H2> <%-- JSP page Directive --%> <%@ page import="java.util.*,coreservlets.*" %> <%-- JSP Declaration --%> <%! private String randomID() { int num = (int)(Math.random()*10000000.0); return("id" + num); } private final String NO_VALUE = "<I>No Value</I>"; %> <%-- JSP Scriptlet --%> <% String oldID = CookieUtilities.getCookieValue(request, "userID", NO_VALUE); if (oldID.equals(NO_VALUE)) { String newID = randomID(); Cookie cookie = new LongLivedCookie("userID", newID); response.addCookie(cookie); } %> <%-- JSP Expressions --%> This page was accessed on <%= new Date() %> with a userID cookie of <%= oldID %>. </BODY></HTML> Listing 12.2 Excel.jsp First Last Email Address Marty Hall hall@coreservlets.com Larry Brown brown@coreservlets.com Steve Balmer balmer@ibm.com Scott McNealy mcnealy@microsoft.com
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
<%@ page contentType="application/vnd.ms-excel" %>
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Listing 12 - Listing 12.1 ImportAttribute.jsp &lt;!DOCTYPE...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online