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

Lab04_ManageUsersByMVC2

The document outlines the steps to create a Java web application using the MVC2 model, HTML, Servlets, JSP, and JDBC to manage users. It includes objectives such as creating web pages, handling data transfer between HTML and Servlets, and performing CRUD operations with SQL Server. The document also details the structure of the project and the necessary classes for models, controllers, and web pages.

Uploaded by

ReDrag
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)
6 views

Lab04_ManageUsersByMVC2

The document outlines the steps to create a Java web application using the MVC2 model, HTML, Servlets, JSP, and JDBC to manage users. It includes objectives such as creating web pages, handling data transfer between HTML and Servlets, and performing CRUD operations with SQL Server. The document also details the structure of the project and the necessary classes for models, controllers, and web pages.

Uploaded by

ReDrag
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/ 18

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.DTO and Models.DAO
packages as the follows:
2.1. Models.DTO package
• User.java

2.2. Models.DAO package


• UserDAO.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:

Step 06. Right-click on Lab04_ManageUsersByMVC2 project, select Run to run


the web app then test all functions.

18 | P a g e

You might also like