Please upload your files to CSNS. The files should include all the source code, documentation (optional), and an HTML file lab4.html which contain a link to your application deployed on the CS3 server. Note that file uploading will be disabled automatically after 10:00PM, so please turn in your work on time.
[JSTL SQL] (20pt)
Company X is conducting a promotion which works as follows:
In this exercise, you are going to help Company X to implement the promotion website as follows.
Create two tables, rewards and customers, in your database, using proper attribute type for each attribute:
rewards:
|
customers:
|
Note that the rewards table contains a list of codes and the rewards associated with them. The reward field could be null, which means there is no reward. The customers table contains a list of customers and their email addresses. Note that an email address uniquely identifies a customer, or in other words, you should not have two rows in the customers table that have the same email address.
Create a JSP page GetReward.jsp. When GetReward.jsp is requested without any parameter, it displays the the following form:
Code: | |
Name: | |
Email: | |
Once a customer fills out the form and clicks the Get Reward! button, the application checks the user input and the content of the database, updates the database if necessary, and displays one of the following messages:
For this problem, you must use the JSTL SQL tags to access the database. And in addition to the JSP files, please turn in a file lab4.sql which includes the SQL statements to create and populate the tables.
[JDBC] (+10pt)
For extra credit, implement the same application using the MVC architecture where the database access is done in servlet using JDBC.
[Custom Taglib] (10pt)
Implement a custom tag to convert an integer to Roman numerals. Feel free to utilize code available online, e.g. Darwin's RomanNumberFormat.
Create a JSP page and test your tag with the following code: