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 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:
16 | P a g e