// set content-type header before accessing the Writer
response.setContentType("text/html");
PrintWriter out = response.getWriter();
// then write the data of the response
out.println("<html>" +
"<head><title>Duke's Bookstore</title></head>" +
"<body bgcolor=\"#FFFFFF\">" +
"<center>" +
"<hr> <br> " +
"<h1>" +
"<font size=\"+3\" color=\"red\">Duke's </font>" +
"<font size=\"+3\" color=\"purple\">Bookstore</font>" +
"</h1>" +
"</center>" +
"<br> <hr> <br> ");
//Align the parts of the page in a table (one row with two cells)
out.println("<table border=0 cellspacing=5 cellpadding=5>" +
"<tr>");
//Left cell -- the "book of choice"
out.println("<td valign=\"TOP\" width=\"55%\">" +
"<h3>What We're Reading</h3>" +
"<p>" +
"In <em><a href=\"" +
response.encodeUrl("/servlet/bookdetails?bookId=203") +
"\"> Servlets: A Web Developer's" +
"Dream Come True</a></em>, author Webster Masterson, "
+ "a world renowned guru on" +
"web development, talks about how servlets can " +
"transform the way you develop" +
"applications for the web. This is a must read for " +
"any self respecting web developer!" +
"</td>");
//Right cell -- various navigation options
out.println("<td valign=\"TOP\" bgcolor=\"#FFFFAA\">" +
"<p><font size=\"+1\"><a href=\"" +
response.encodeUrl("/servlet/catalog") +
"\">Catalog</a></font><br>" +
"Choose from our excellent selection of books." +
"<p><font size=\"+1\"><a href=\"" +
response.encodeUrl("/servlet/showcart") +
"\">Shopping Cart</a></font><br>" +
"Look at your shopping cart to see the books " +
"you've chosen" +
"<p>" +
"<font size=\"+1\"><a href=\"" +
response.encodeUrl("/servlet/cashier") +
"\">Buy your Books</a></font><br>" +
"Pay for the books you've put in your cart!" +
"</td>" +
"</tr>" +
"</table>" +
"<br> " +
"<br> " +
"<br> " +
"<center><em>Copyright © " +
"1998 Sun Microsystems, Inc. </em></center>" +
"</body>" +
"</html>");
out.close();