Question: When the application is requested without any parameter, it displays the list of the vaccines and doses at the hospital as shown below: New Vaccine

When the application is requested without any parameter, it displays the list of the vaccines and doses at the hospital as shown below:

New Vaccine | New Doses -->blue links that redirect to the servlet

Vaccine Doses Required Days Between Doses Total Doses Received Total Doses Left
Pfizer/BioNTech 2 21 5000 5000 Edit
Johnson & Johnson 1 5000 5000 Edit

For each vaccine, the system displays the name of the vaccine, the number of doses required to fully vaccinate a patient, the number of days between doses if more than one dose is required, the total doses the hospital has received, and the total doses left (i.e. not yet given to patients).

Suppose the hospital receives a new type of vaccine, a user can add it to the system by clicking on New Vaccine, which will take the user to a page where a new vaccine can be added. For example:

Name
Doses Required 2
Days Between Doses
Add

Note that after a new type of vaccine is added, the application should redirect the user to the vaccine listing page. The Total Doses Received/Left of the new vaccine should be 0 as new doses will be added using the New Doses function.

Suppose the hospital receives a new shipment of vaccine doses, a user can add it to the system by clicking on New Doses, which will take the user to a page where the new number of doses can be added. For example:

Vaccine Pfizer/BioNTech
New Doses Received
Add

Note that the dropdown list must be dynamically generated based on the vaccines currently in the system. In other words, if a new vaccine was added using the New Vaccine function, it should be listed in the dropdown list.

After new doses are added, the application should redirect the user to the vaccine listing page, and the Total Doses Received/Left of the vaccine should be updated with the new doses added.

  • The vast majority of web applications can be considered as data + operations on the data, so first identify the data in this application and create the corresponding classes (e.g. Vaccine), then identify the operations in this application, e.g. display vaccines, add vaccine, add doses, and so on.
  • Create one servlet for each operation. If an operation involves form processing, use doGet() to display the form and doPost() to process the form.
  • 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.
  • Changes made by the users (e.g. new vaccines and doses) need to be stored in application scope but do not need to be saved to a file. Those changes will be lost after the application is unloaded or reloaded.
  • Do not spend too much time beautifying the user interface - you can do that in later assignments when we use JSP.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!