Sunday, February 5, 2023

User Registration using Jsp, Servlet and Jdbc

In this post we will create a simple user registration example using Jsp, Servlet, Jdbc in eclipse and tomcat. We will create a user registration form using jsp. On submitting the form, control goes to a servlet. The servlet calls the dao class function, that further communicates with the mysql database using jdbc. And the user registration data is inserted into the database.

Following technologies are being used

  • Jdk
  • Eclipse
  • Tomcat
  • Mysql
  • Servlet
  • Jsp
  • Jdbc

User Registration Jsp to Servlet to Mysql Flow Diagram




Lets Begin

Step 1: Create database table for member

Create a new database called userdb in mysql. In the userdb database create a table called member.

Step 2: Create a memberRegister.jsp for the user registration

Step 3: Create a dto class Member.java

This is a dto or data transfer object class that has fields according to the fields in the database table.

Step 4: Create a Servlet named Register.java

Control should go from the jsp to a servlet, so we will create a servlet here named Register.java. When jsp form is submitted control will go to the post method.

From the post method a dao class function is called that inputs into the database using jdbc.

Step 5: Create a Dao class RegisterDao.java

The dao class contains the jdbc code to insert into the mysql database member table.

Step 6: Access the jsp page from browser

Open the url http://localhost:8080/registration/memberRegister.jsp from the browser. Fill up the required fields and hit the submit. Data will be entered in to the member table.


This completes the the jsp servlet jdbc user registration example.

Download Source Code Here


https://www.javatutoronline.com/servlets/jsp-servlet-jdbc-registration/

https://www.youtube.com/watch?v=_oEOH23OYYQ&list=PLX4AhrTV6sqqQQyJraZwYgs6IFXZPpA2m&index=46








 ..

No comments:

Post a Comment

CORBA Java Tutorial using Netbeans and Java 8.

CORBA-Example A simple CORBA implementation using Java Echo.idl module EchoApp{ interface Echo{ string echoString(); }; }; ...