For the simple database structure below, use the following definitions for each data field in each table as well as the java model
Table/Field name | Database field type | Java Model field type |
Products table | ||
ProductId | INTEGER | java.lang.Integer |
Description | VARCHAR | java.lang.String |
Price | DECIMAL | java.math.BigDecimal |
LineItems table | ||
OrderID | INTEGER | java.lang.Integer |
ProductId | INTEGER | java.lang.Integer |
Quantity | INTEGER | java.lang.Integer |
TotalPrice | DECIMAL | java.math.BigDecimal |
Orders table | ||
OrderId | INTEGER | java.lang.Integer |
FirstName | VARCHAR | java.lang.String |
LastName | VARCHAR | java.lang.String |
Address | VARCHAR | java.lang.String |
City | VARCHAR | java.lang.String |
State | VARCHAR | java.lang.String |
SubmissionDate | DATE | java.sql.Date |
For the database data submission:
Add 5 entries to the products table using sql statements not a web page)
Create the following web application using Struts2
Name it OrderSubmission
Create a Welcome page that has links to the below actions required except number 5.
Create an action to submit an order (create an order) with:
An Order input page with the customer information(first name, last name, address, city, state)
Items – at least 2 items per order. The User can choose a product and quantity from a drop down list on the Order input page. There is an Add button to add a new order item.
The result of the order is a view, with the customer information and a table to show the items bought and will allow the user to update the order created.
Create an action to retrieve (one order, by an order id) - It is not search
An input page with a text field for the order Id that the user provides, and a Submit button.
The result of the action will be the detail page of the order, with the list of items in a table.
The above page in point 4.b will be dynamically created, not a static page. The User will be able to update both the order information and the line items within the order by clicking on an Update button.
Create the action to take care of point 4.c
Requirements
- use MVC architecture
- Struts2, jsp view pages
- web.xml and struts.xml as configuration files
- Field validation - use xml validation (Framework Validator) - check for data types, empty fields, and show appropriate error messages.
- MySQL database
- Use pooling to connect to a MySQL database
- GlassFish 4.0 Server
- Eclipse Luna