Lab04_ManageUsersByMVC2
Lab04_ManageUsersByMVC2
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:
2|Page
Step 02. Write codes for the classes in the Models.DTO and Models.DAO
packages as the follows:
2.1. Models.DTO package
• User.java
3|Page
4|Page
5|Page
6|Page
7|Page
Step 03. Write codes for the classes in the Controllers.Authentication
package as the follows:
• LoginController.java
8|Page
Step 04. Write codes for the classes in the Controllers.User package as the
follows:
• CreateController.java
• SearchController.java
9|Page
• DeleteController.java
10 | P a g e
• UpdateController.java
11 | P a g e
• UserDetailsController.java
12 | P a g e
• UserController.java
13 | P a g e
Step 05. Write codes for the web pages as the follows:
• Login.html page
• CreateUser.jsp page
14 | P a g e
• Search.jsp page
15 | P a g e
• DisplayMessage.jsp page
16 | P a g e
• UserDetails.jsp page
17 | P a g e
Step 05. Open the web.xml in the WEB-INF folder then update as the follows:
18 | P a g e