Implement a web application called CS320Starter, which is similar to the crowd funding platform Kickstarter where people raise funds for their projects. In this project, you are going to implement some basic features using servlets or a combination of servlets and HTML pages.
Note that
• Only projects that are still in their funding period should be included in the list.
• Start Date should be formatted as shown in the example above.
• Days To Go should be calculated as Funding Duration - (Current Date - Start Date), and the list should be sorted by Days To Go in ascending order.
2. Clicking on the name of a project should take the user to the Project page where all the information about the project is shown. For
example:
Arabic Alphabet Fun Flashcards
by Koloud
This cute endeavor is for the creation of Arabic Alphabet Fun Flashcards that are printed on super durable coated paper that is sure to survive the strongest baby teeth known to man. The flashcards will be mailed out in a handmade bag made with awesome fun bright fabrics. 28 letter cards, an introduction card, and a game card are included with each set.
Funding Target: $3000
Start Date: Dec 16, 2012
Funding Duration: 35
Days to Go: 2
Pledge $1 or more
An entire blog post devoted to you. Yes, you. Now you have the ability to bing or google your name and there it will be in big lights: seen by tens of people.
Pledge $10 or more
A personalized shukran card mailed to any address you choose. These cards are handmade and one of a kind!
Pledge $20 or more
A Crafty Arab swag bag with a personalized shukran card, Arab pin, and celebrity with Arab name magnet mailed to any address you choose.
All Projects
Clicking on the All Projects link should take the user back to the project listing.
3. When a user clicks on the Create A Project link, the application shows the Create Project page where the user can create a new project:
Create Project - Basic Information
Start Date should be entered in the format MM/dd/yyyy, e.g. 01/16/2013. After the user fills out the form and clicks the Next button, the application shows the Add Reward page where rewards can be added to the project:
Create Project - Add Rewards
Pledge Amount:
|
$ or more
|
Reward Description:
|
|
Pledge Amount: $ or more
Reward Description:
Rewards can be added one at a time by filling out the form and clicking the Add button. After all the rewards are added, the user can click the Finish button and the application should take the user to the Project page.
• As I said in class, the vast majority of web applications can be considered as data + operations on the data, so a) identify the data in this application and create corresponding classes (e.g. Project and Reward), and b) identify the operations in this application (e.g. display all projects, display a project, create a project, add a reward), and for each operation, create a servlet.
• To focus on the main functionality, we will assume that the users will always provide proper input - in other words, you do not need to implement any input validation.
• Since we have not covered databases yet, the application should store all the data in Servlet Context. The data will be lost after the application is unloaded or reloaded, and that's OK for this assignment.
• Do not spend too much time beautifying the user interface - you can do that in later assignments when we use JSP.
In this assignment you are going to continue to work on the application CS320Starter. All features described in Homework 1 must work properly; otherwise you will not receive any credit.
1. Security.
Implement security so that all users can view the information about the projects, but only authenticated users (i.e. users who have already logged in) can create and sponsor projects. In particular, your implementation must meet the following requirements:
• Whenever a user tries to create or sponsor a project, the application should first check whether the user is already logged in. If not, the user should be redirected to a login page where they must provide a valid username and the corresponding password.
• User authentication must happen on the server side, i.e. you cannot use JavaScript to validate username/password on the client side.
• Once a user is authenticated, a session is created so the user won't be asked for username and password repeatedly. A user may choose to log out, in which case the session should be terminated. For session tracking, you must use Servlet Session Tracking API.
• Two user accounts should be pre-created for testing purposes:
o Username cysun and password abcd
o Userrname cs320stu31 with password abcd
Note that a few changes must be made to the user interface as part of the security implementation:
• A Login/logout link should be shown on each page. The link should show Login if the user has not logged in yet, and Logout if the user is already logged in.
• After a user logs in (or logs out), the user should be redirected to the Project List page.
• The name of the user is no longer needed when a user creates a project, because the user would have already logged in and the server should keep track who the user is.
2. Sponsor A Project
A link Sponsor This Project should be shown on the Project page. When a user clicks on the link, the application shows a form where the user can enter a dollar amount and select a reward. Note that
• A user can only sponsor a project once. After a user sponsors a project, the Sponsor This Project link will no longer be shown to that user.
• The Project List page should be change to show the funding progress of the projects. In particular, two columns Percentage Funded and Amount Pledged should be added to the display.