I've provided code for you for a new version of the Beer MVC Servlet from HFSJ, that builds on the H07 version by changing the Model to one that uses a MySQL database. We are using some (though not all) of the MySQL "best practices". Here's what we are doing that is right:
PreparedStatement
properly to avoid SQL InjectionHere are a few things we should be doing that we are not doing yet. We'll cover these in future homeworks if time permits.
web.xml
) to set the JDBC URL, username, and password, instead of hard coding those inside the controller servlet.<javac>
Ant task allows us to see the line numbers when we print a stack trace.In this assignment, you will:
The following reading is recommended:
You can obtain the source either as:
You may also browse the source in the H08 directory.
Download this to your development directory. You can do this directly on porsche in the same way that you did it for H07 (see H07 for details).
Before you deploy it, follow the steps to set up your own database. You can use the file beerAdvisorDB/sql/create_BA_Beers.sql as a model, and use the procedure outlined on the SQL_GettingStartedWithSQLInCISC474 wiki page.
Now, create your own app, using the same product you used in H05,H06 and H07.
You'll create a static HTML page http://copland.udel.edu/~jstudent/cisc474/H08 that contains
Here is some advice from the wiki on creating a tarball and creating a zip file
Be sure that the link you created in Step 4 works properly for downloading your source distribution.
Be sure when you go into WebCT, that you both upload and submit.
(The reason to have you also submit on WebCT as well as putting the code on the web is that submitting on WebCT (a) creates a permanent archive, (b) establishes a submission time, and (c) enables the TA to give you a grade.)
Item | Description | Points |
---|---|---|
SQL | You have an sql directory with an SQL file to create and populate your database. | 10 |
Java code | Your Java code works and is well commented and structured | 15 |
Javadoc | Your code has proper javadoc (i.e. not the Javadoc that was in my code, still unmodified!) |
10 |
Ant | Your build.xml file looks reasonable | 10 |
JUnit | You have reasonable JUnit tests, and they are updated to reflect the database version of the Servlet (just like the BeerAdvisorDB example illustrates) | 10 |
WAR file | You used a WAR file | 10 |
Scripting and Submitted | You followed instructions for scripting and submitting | 10 |
Reasonable package names | No example.com type package names | 5 |
index.html | Not form.html | 5 |
tarball or zip file of source distribution works properly |
Top level directory is correct, you can unpack and do Ant, and get a menu. global.properties need to be changed only for classpath, and for deployment reasons. | 5 |
HTML validates as HTML 4.0.1 strict, XHTML 1.0 strict, or XHTML 1.1 | You should have a validation icon on your index.html, and your "result" HTML should validate when you copy and paste the view source of the resulting HTML (not the JSP source) into the "validate by direct input" box at http://validator.w3.org (the third one down). | 10 |
TOTAL POINTS |