You are asked to create a Java web application called ShopList. This application will allow users to create a shopping list of items they want to buy. Users will each have to log in to the system before they can create a list, and users who have not logged in will not be allowed to create a shopping list.
The solution you create for this assignment must use only servlets for both UI output, and data processing. You will create individual sessions (HttpSession) for each user to hold his/her username, and the list of items s/he has added to the list (as an ArrayList<String>). Both the username and the shopping list should be stored as attributes of an individual user's session.
Create three servlets in your solution:
The user will also be able to log out of the application from here
LoginPage submits the username and password to Validate. For this application only a user called "user", with a password of "pass" will be considered valid. If invalid details are submitted Validate will send the user back to the login page, and have it display a message stating "Invalid username or password!". If either or both login values are missing, again the user will be sent back to the login page, this time with a message of "Both values required!"
If the required data is given, and is valid, then Validate will do a number of things:
Initially, ListPage should show as follows:
The name after "Hello, " would be the name of any valid user who has logged in (it is not hard-coded).
The form below the welcome message allows the user to add a new item to his/her shopping list. The list is initially empty, but shows the heading anyway.
Here the user has added "apples" as an item.
The list shows the items in the order they were added, using alternating background colours for the rows to aid readability.
Each time a new item is to be added to the list, the form should submit the form data back to the
ListPage servlet. This will add the new item into the ArrayList<String> created in the use's session during login.
The Logout hyperlink to the right of the welcome message in ListPage should take the user to the Validate servlet, sending it a parameter called "logout" which Validate will detect and which will cause it to destroy the user's session, and then send the user back to the login form while displaying a message stating "Logged out".
Users who have not logged in should not be able to navigate directly to the ListPage. If anyone attempts to do this s/he should be sent back to the login page, which should display a message stating "Not logged in!".
Assignment Writing Help
Engineering Assignment Services
Do My Assignment Help
Write My Essay Services