User Management Project Using Servlet, JSP, JDBC and MySql Using Eclipse
First Of all , You have to open your Eclpise.
First Click New-> Dynamic Web Project-> Give Name in Name field
as UserManagemntSystem
At this time You can check ur tomcat version(I use tomcat 8.5) and Dynamic web module version (in my case i m using 3.1)
Then U click on next -> next...then click a check box to create web.xml dynamically ...Then Click finish.
So now we have to do a dynamic web project UserManagementSystem , in which we have a java resource folder inside which we have a src folder and we have to write all the java classes here inside this src folder .
And we have also a webcontent (some cases webapp) -> Inside webcontent we have -> WEB-INF , and inside WEB-INF -> Lib folder
Inside the lib folder we have to paste all our libraries which we have to use in our project.
We have a web.xml file where we have to write xml configuration
First of we are going to create all the packages whatever we are going to use for this project.All the packages are to be created inside src folder .
So right click on the src-> Choose New-> Choose Package
write the package name here as bean package(inside this we have to create our model )
Then click finish button
Then our next package is our DAO package (inside this we have to create our database related class)
The next package is Web package(inside this we have to create our servlet class) :
So now i have to create a bean class first ...So i have to right click first on our bean package then in name field i have to write User as i have to create an User bean to store the information about the user.
Select all fields and then click ok.
Now you have to create a constructor :
1. Parametric Constructor :
With selecting all fields then click ok
Now I have create one more constructor (excluding the id )
Step are same but here only you have to deselect Id, and create the constructor
Now I have to create a DAO class
named this class as UserDao
Inside Dao class I have to configure our JDBC driver , I will have to LOAD the Driver , I will take the connection and after i will write all the methods i,e, to insert the data, to edit the data , to delete data and to view the data .
Before Using The Dao Class , We have to put/import all the jar libraries inside the lib folder .
Update the UserDao.java
After creating the UserDao class we have to create a servlet .
Now you have to open your web package and right click then select new and then click on servlet.
Write this.in your servlet
After that u have create jsp file
user-list.jsp and user-form.jsp
user-form.jsp