Programming for the WWW G22.3033-009

Homework Assignment #4
Homework Due:
Nov 25, 2002

1) You must change the mechanism used by the Customer class to use Java serialization to write an object out to disk and to read it back in from disk (instead of the file writing code you created yourself to save a customer to disk).. It should use the same naming convention but have the ".ser" extension instead of the ".txt" we used before.

2) Modify the servlet that you created in HW#3 to use this serialization/deserialization mechanism to read/write customer objects.

3.) Create a JSP that is the customer information browser (GVBooksCustomerBrowser screen shot below). It should have a list of all the customer files that are stored on your application.

bulletI should see a list of CustomerId, Customer FirstName and LastName per line of the list. This means you need to read into memory all the customers that have been serialized out via the
bulletI can pick an item and via a POST (the button View) invoke a different JSP that displays the information on that specific customer by reading the file for that customer (should be something like Customer.1.ser)

4) Create a JSP that is a home page  (like GVBooksMain screen shot below) with SUBMIT BUTTONS in a form that have links to execute each of the JSPs/Servlets in this homework. That means you need BUTTONS for:

bulletAdd or Update Customer  (should be the HW#3 functionality)
bulletBrowse Customers
bulletBrowse Orders

This JSP should use POSTs to tell this JSP what JSP/Servlet to execute next. You should use the RequestDispatcher class in your JSP to accomplish the jumping to the selected JSP/Servlet.

The grading criteria for this homework:

1) Create 4 JSPs or 3 JSPs and 1 servlet (the CustomerInfo from HW#3)

2) The main page should use a POST and SUBMIT button that uses if statements to use a RequestDispatcher and the forward()method to invoke the corect JSP from the code in the main JSP.

4) The main page should invoke 1 of three other JSPs - CustomerInfo, CustomerBrowser and OrderBrowser.

5) CustomerInfo should be a working JSP (or Servlet if you wish) that saves and loads a customer object from disk. You can hard code the file name that the object gets saved/loaded from

6) The CustomerBrowser and OrderBrowser JSPs can be dummy JSPs with only the list and buttons but no code to actually load the stuff from disk or display anything.

7) The Customer class must use serialization to save out individual customer objects and load them back in.

8) You MUST use localhost:8080 in all your URLs in your code!! Not your specific machine name or IP address or anything else.

Hints and Help

Here is the HTML to use for the Order Browser JSP


<html>
<head><title>GV Bookstore Order Browser</title></head>
<body>



<br><br><br>GV Bookstore Order Manager<br>
<hr>

<p>Orders</p>
<form method="POST" action="http://localhost:8080/somepage.jsp">
<p>
<select size="10" name="D1">
<option>00001 - Customer 0001 - Nov 1, 2002</option>
<option>00002 - Customer 0001 - Nov 13, 2002</option>
<option>00003 - Customer 0020 - Nov 21, 2002</option>
<option>00010 - Customer 0002 - Aug 1, 2002</option>
</select></p>
<p>&nbsp;</p>
<p><input type="submit" value="View Order" name="ActionToDoBUTTON"><input type="reset" value="Reset" name="B2"></p>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>


</body>
</html>

 

 

Here is for the Customer Manager JSP

 
<html>
<head><title>GV Bookstore Customer Manager</title></head>
<body>



<br><br><br>GV Bookstore Customer Manager<br>
<hr>
<p>Customers</p>
<form method="POST" action="http://localhost:8080/somepage.jsp">
<p>
<select size="10" name="D1">
<option>00001 - John Smith</option>
<option>00002 - Jane Doe</option>
<option>00003 - Bill Gates</option>
<option>00010 - Fred Flintstone</option>
<option>00025 - Fred Fish</option>
</select></p>
<p>&nbsp;</p>
<p><input type="submit" value="View Customer" name="ActionToDoBUTTON"></p>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>

</body>
</html>
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



 Copyright Poelman & Associates, Inc. (c) 2002 
For problems or questions regarding this web contact [ClassWebEmail].
Last updated: 11/05/02.