0% found this document useful (0 votes)
33 views11 pages

Lab03 SearchUsers

Uploaded by

tungnkss160730
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views11 pages

Lab03 SearchUsers

Uploaded by

tungnkss160730
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Building an Java Web Application

Using HTML, Servlet, JDBC & RequestDispatcher


Requirements
Create a java web application (using HTML, Servlets and JDBC) to perform functions
as login and search users.

Lab Objectives
In this lab, you will be:
▪ Create Java web project using the NetBean IDE
▪ Create the web pages by HTML
▪ Apply passing data from HTML to Servlet by GET and POST method
▪ Apply RequestDispatcher to pass data between Servlets
▪ Performs CRUD functions by SqlJDBC driver and SQL Server
▪ Run the project and test the functions of the application

1|Page
Step 01. Create a Java Web application named Lab03_SeachUsers is
structured as follows:

-Open SQL Server Management Studio and create a database named


SampleDB has a table named Registration as follows:

2|Page
Step 02. Write codes for the classes in the DBUtils package as the follows:
• User.java

• UserDAO.java

3|Page
4|Page
5|Page
Step 03. Write codes for the classes in the UserServlet package as the
follows:
• LoginServlet.java

6|Page
• ProcessServlet.java

7|Page
• SearchServlet.java

• ShowSearchResultServlet.java

8|Page
• RemoveServlet.java

9|Page
Step 04. Write HTML codes for the web pages as the follows:
• Login.html page

• Invalid.html page

• Search.html page

10 | P a g e
Step 05. Open the web.xml in the WEB-INF folder then update as the follows:

Step 06. Right-click on Lab03_SearchUsers project, select Run to run the web
app then test all functions.

11 | P a g e

You might also like