0% found this document useful (0 votes)
4 views

Lab 08 Servlet - JDBC - Web Eng

Uploaded by

tasawarnawax190
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lab 08 Servlet - JDBC - Web Eng

Uploaded by

tasawarnawax190
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Web Engineering Lab Lab 08

Web En g in eer in g Lab


Lab 08 Marks 100
Instructions
Work on this quiz/lab individually.
You are NOT allowed to use internet, mobile phone.
You are NOT allowed to borrow anything from your peer student.
What you have to do
Program the following tasks. The name of your files will be according to the task given in this lab.

Task [100]
Create a Servlet application that allows a user to perform CRUD (Create, Read, Update and Delete) operations on an address-book.
The application should use the GET method for reading, and the POST method for creating, updating and deleting the person record.

Step 1: Create a new Java web project and add a Servlet class (e.g., personInfo).

Step 2: In doGet() method, add code to get and display all the available records in HTML tabular format. The table should be
generated dynamically by reading the records from the database and adding them as rows to the HTML table.

Step 3: In doPost() method, add code to handle the creation, updation and deletion of person’s record in the database. The
servlet class should handle the following actions:

 Creation: A user should be able to add a new person’s record to the database by submitting a form that includes fields for
the person's name, address and phone.

 Updating: A user should be able to update the details of an existing record by submitting a form that includes fields for the
person's name, address and phone.

 Deletion: A user should be able to delete a person’s record from the database by submitting a form with a field for the
person’s name.

Step 4: Create web.xml file and map the servlet class to a specific URL pattern, for example, "/personInfo"

Step 5: Create HTML forms for adding, updating and deleting person records. The forms should use the POST method and have the
action set to the URL pattern mapped to the servlet in web.xml

Step 6: Test the application by adding, updating and deleting persons’ records, and ensure that the changes are reflected in the
table.

Instructions:
 You need to create appropriate database, and table to save the persons’ records.
 A person record shall consists of name, address, and phone.
 In doPost() method, you can have if-else if conditions to perform the specific task (i.e., creation, updating and
deletion).
 Deploy the JDBC connector file in the lib folder which shall be placed parallel to the classes folder in your web-
application.

   BEST OF LUCK   

Hassan Khan, PU. Lahore. Page 1 of 1

You might also like