Description:
Create a web application for Sheridan Restaurant Reviews that contains the following functionality:
• Display a table of all restaurants based on the city entered by the user and whether the restaurants allow take-out orders or not
• Allow the user to update the ratings of a restaurant
1. Database - Restaurants.sql
The provided script does the following:
- Creates a new database called RestaurantReviews
- Creates a new table called Review and populates it with some records:
o ReviewId - An auto-incremented value that represents this table's primary key
o Restaurant - The name of the restaurant
o Food - The restaurant's score for food
o Service - The restaurant's score for service
o Price - The restaurant's score for menu prices
o Location - The city where the restaurant is located
o Cuisine - The type of cuisine served at the restaurant
o TakeOut - A true value indicates that the restaurant allows for take-out orders
2. Your Web Application
a) Make sure the DBConnection and MySQL JDBC Driver libraries are imported in your new project.
b) Modify index.html by adding two HTML forms - one for each function within the application.
• Each form should send a request to an appropriate servlet
• The Price Rating field when updating a restaurant review should be a dropdown list with the values 1, 2, 3, 4, 5 in that order
c) Your database configuration must be stored as a series of context-initialization parameters.
d) Your solution must have a ServletContextListener that does the following when the application loads:
• Get the database configuration from the ServletContext
• Construct a new DBConnection object based on the database configuration
• Store the DBConnection object as a ServletContext attribute
e) Create a JavaBean that maps with the Review table of the database
f) Create a DAO class that contains methods that do the following:
• Get restaurants by location. This method should have parameters for a Connection object, the city, and whether to return restaurants that allow take-out orders. Your results should be ordered by descending food rating, then descending service rating.
The method should return a list of Review beans.
• Update a restaurant review. This method should have parameters for a Connection object and the values required to update a restaurant review's ratings. The method should return true if the new review was successfully updated, false otherwise.
g) Create a servlet that handles requests to get a list of restaurants by location
• The request should be forwarded to a JSP which will display a table of those restaurants
h) Create a servlet that handles requests to update a restaurant's review
• Forward the request to index.html if the restaurant review was successfully updated
• Forward the request to an error page if the restaurant review was not updated
i) Create a JSP that displays a table of all restaurants that match the selected criteria. Below is the sample page if the user wanted to view all restaurants in Brampton that allow take-out: