Howdy. 

Prepare the final exam. 

Finish the project. 

Stage One: describe the problem, clearly establish the purpose of stages two and 
three, and in the process you will provide some of these in code/prototype form. 

Stage Two: code (plus documentation).

Stage Three: code (plus documentation). 

[chen401@silo monday]$ pwd
/u/chen401/c212-workspace/apache-tomcat-7.0.35/webapps/monday
[chen401@silo monday]$ ls -l
total 4
-rw------- 1 chen401 students 422 Dec  5 15:03 controller.jsp
[chen401@silo monday]$ cat controller.jsp
<table>
  <tr> <td colspan=3 align=center>
       <font size=+3>Welcome to
       <img valign=middle src="http://1ue0vq2ip2m91b3g7z258a5v.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/Amazon-Logo-Grocery-Deals.png">
       !</font>
  <tr> <td width=33% align=center> Search: <input type=text size=10>
       <td width=33% align=center> View Cart
       <td width=33% align=center> Browse Merchandise
</table>

[chen401@silo monday]$

Next let's understand the various stages. 

[chen401@silo monday]$ ls -l
total 8
-rw------- 1 chen401 students   73 Dec  5 15:27 ben.jsp
-rw------- 1 chen401 students 2638 Dec  5 15:33 p007.jsp
[chen401@silo monday]$ cat ben.jsp


log<sub>2</sub>3 = <% out.println( Math.log(3.0) / Math.log(2.0) ); %>
[chen401@silo monday]$

And then:

<%@ page language="java" import="java.util.*" %>
<table>
  <tr> <td colspan=3 align=center> 
       <font size=+3>Welcome to 
       <img valign=middle src="http://1ue0vq2ip2m91b3g7z258a5v.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/Amazon-Logo-Grocery-Deals.png">
       !</font> 
  <tr> <td width=33% align=center> Search: <form> <input type=text name=for size=10> 
                                                  <input type=hidden name=action value=search> 
                                           </form> 
       <td width=33% align=center> <a href="?action=view_cart">View Cart</a> 
       <td width=33% align=center> <a href="?action=browse">Browse Merchandise</a>
</table> <p> 
<% String action = request.getParameter("action"); 
   if (action != null) {
     if (action.equals("browse")) { %>
       <jsp:include page="brows003.jsp">
       <jsp:param name="show" value="all" />
       </jsp:include>
<%   } else if (action.equals("view_cart")) { 
       out.println("You want to View the Cart: <ul> "); // + session); 
       int i = 0; 
       for (Enumeration e = session.getAttributeNames(); e.hasMoreElements(); i++) { 
         String attribName = (String) e.nextElement();
         Object attribValue = session.getAttribute(attribName);
         out.println("<li>" + attribName + ":" + attribValue); 
       } 
       if (i == 0) out.println( "Your cart is empty." ); 
       else out.println("</ul><p>Click <a href=\"?action=reset\">here</a> to reset your cart."); 
     } else if (action.equals("add")) { 
       String what = request.getParameter("what"); 
       if (what != null) {
         Object howMany = session.getAttribute(what); 
         if (howMany == null) {
           session.setAttribute(what, new Integer(1)); 
         } else {
           session.setAttribute(what, 1 + (Integer)howMany); 
         } 
       } out.println("The item (" + request.getParameter("what") + ") has been added to your cart."); 
     } else if (action.equals("reset")) { 
       for (Enumeration e = session.getAttributeNames(); e.hasMoreElements(); ) {     
         String attribName = (String) e.nextElement();
         session.removeAttribute(attribName); 
       } 
       out.println("Your cart is now empty."); 
     } else if (action.equals("search")) { 
       String search = request.getParameter("for");
       out.println("Searching for... <font size=+3>" + ( search == null ? "undefined" : search ) + "</font>"); 
     } else { 
       out.println("Not sure what " + request.getParameter("action") + " is... "); 
     } 
   } else {
     out.println("Click on some of the links above..."); 
   }
 %>

That's the controller and associated views. 

<% String show = request.getParameter("show"); 
   if (show != null) {
     if (show.equals("all")) { %> 
Here's what we are selling: <p> 
<ul>
  <li> <a href="brows003.jsp?show=sku-001">1974 George Nakashima End Table</a>
  <li> <a href="brows003.jsp?show=sku-002">Chinese Wooden Guanyin Figure (1200-1500)</a>
  <li> <a href="brows003.jsp?show=sku-003">White Jade Mounted Cigarette Box</a>
  <li> <a href="brows003.jsp?show=sku-004">Hawaiian Kou Bowl, ca. 1840</a>
  <li> <a href="brows003.jsp?show=sku-005">Porcelain Cabaret Coffee Set, ca. 1900</a>
  <li> <a href="brows003.jsp?show=sku-006">French Crystal Regulator, ca. 1900</a>
  <li> <a href="brows003.jsp?show=sku-007">Pocket Watch & Chatelaine, ca. 1790</a>
  <li> <a href="brows003.jsp?show=sku-008">Fremont Ellis Painting</a>
  <li> <a href="brows003.jsp?show=sku-009">1821 U.S. Citizenship Certificate</a>
  <li> <a href="brows003.jsp?show=sku-010">Late Period Egyptian Bronze Falcon</a>
  <li> <a href="brows003.jsp?show=sku-011">Dr. Seuss "Kangaroo Bird," ca. 1938</a>
</ul> 
<%   } else if (show.equals("sku-001")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>1974 George Nakashima End Table</font></font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/Boise_20130629_01/201304A24/ARS1304_763-crop-c0-44__0-31-400x225.JPG"> <p> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-001"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-002")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>Chinese Wooden Guanyin Figure (1200-1500)</font>
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/Boston_20120609_01/201201A46/ARS1201_2054-crop-c0-53__0-31-400x225.JPG"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-002"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-003")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>White Jade Mounted Cigarette Box</font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/Detroit_20130601_02/201301T16/anro-001805-wa201301T16-hires-crop-c0-31__0-34-400x225.jpg"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-003"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-004")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>Hawaiian Kou Bowl, ca. 1840</font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/Portland_20040821_01/200405A52/img00019138-crop-c0-39__0-42-400x225.jpg"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-004"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-005")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>Porcelain Cabaret Coffee Set, ca. 1900</font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/Cleveland_20150711_05/201504A42/anro-002016-201504A42-retina-2560x1440-crop-c0-43__0-38-400x225.jpg"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-005"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-006")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>French Crystal Regulator, ca. 1900</font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/Boston_20120609_01/201201A33/ARS1201_1480-crop-c0-52__0-55-400x225.JPG"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-006"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-007")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>Pocket Watch & Chatelaine, ca. 1790</font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/Chicago_20030726_01/200302A20/IMG_0731-crop-c0-5__0-5-400x225.JPG"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-007"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-008")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>Fremont Ellis Painting</font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/LittleRock_20150725_10/201501T48/201501T48A-crop-c0-47__0-54-400x225.jpg"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-008"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-009")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>1821 U.S. Citizenship Certificate</font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/Boston_20000819_01/200008A10/IMG0085-crop-c0-37__0-4-400x225.jpg"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-009"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-010")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>Late Period Egyptian Bronze Falcon</font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/Boston_20000819_01/200008A41/IMG0019-crop-c0-45__0-33-400x225.jpg"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-010"">Add item</a> to cart</font>. 
  </table>
<%   } else if (show.equals("sku-011")) { %> 
  <table> <tr> <td colspan=2> 
  <font size=+2>Dr. Seuss "Kangaroo Bird," ca. 1938</font> 
  <tr> <td colspan=2>
  <img src="http://www-tc.pbs.org/prod-media/antiques-roadshow/__sized__/Images/SanDiego_20010630_01/200103A49/IMG0052-crop-c0-42__0-43-400x225.jpg"> 
  <tr> <td> <font size=+2>Price: $23.67</font> 
       <td align=right> <font size=+2><a href="p007.jsp?action=add&what=sku-011">Add item</a> to cart</font>. 
  </table>
<%   } else { %> 
  <blockquote><font size=+3>Sorry the item you're looking for does not exist.</font>
<%   } 
   } else {

   }
 %>

That's the model and the associated views. 

Minute paper: state of the project since last Monday. 

--