0% found this document useful (0 votes)
30 views16 pages

Lab04 ManageUsersByMVC2

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)
30 views16 pages

Lab04 ManageUsersByMVC2

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/ 16

Building an Java Web Application

Using MVC2 & JSP


Requirements
Create an Java web application (using HTML, Servlets , JSP and JDBC) by MVC2
Model to perform functions as manage users.

Lab Objectives
In this lab, you will be:
▪ Create Java web project by MVC2 Model
▪ Create the web pages by HTML, and JSP (Views)
▪ Apply passing data from HTML to Servlet by GET and POST method
▪ Apply RequestDispatcher to pass data between Servlets (Controllers)
▪ Performs CRUD functions by SqlJDBC driver and SQL Server (Models)
▪ Run the project and test the functions of the project

1|Page
Step 01. Create a Java Web App named Lab04_ManageUsersByMVC2 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 Models package as the follows:
• User.java

• UserDAO.java

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

• AddServlet.java

8|Page
• SearchServlet.java

9|Page
• DeleteServlet.java

10 | P a g e
• UpdateServlet.java

• UserDetailsServlet.java

11 | P a g e
Step 04. Write codes for the web pages as the follows:
• Login.html page

12 | P a g e
• Invalid.html page

• AddUser.jsp page

• Search.jsp page

13 | P a g e
14 | P a g e
• DisplayMessage.jsp page

• UserDetails.jsp page

15 | 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 Lab04_ManageUsersByMVC2 project, select Run to run


the web app then test all functions.

16 | P a g e

You might also like