Javatpoint Logo
Javatpoint Logo

Struts 2 Registration Form Example

In this example, we are going to create a registration form using struts UI tags and store these information into the oracle database. You may use other database also such as mysql, DB2 etc. according to your requirement.

Let's see the table first that we need to create in the oracle database.

It will be better for you to create an id for each user. To simply the example, we have not alloted any id with primary key enabled. But you can do it.

The steps to create the registration application in struts2 are as follows:

  1. Create input page (index.jsp)
  2. Create the action class (
  3. Create the class to store data (
  4. Map the request in (struts.xml) file and define the view components
  5. Create view components

1) Create input page (index.jsp)

It is the simple jsp page that uses struts 2 UI tags to create a form to get input from the user.


2) Create the action class (

This Action class has five fields and one execute method. As we know, struts framework creates instance of the action class per request, we are passing this object in the save method of RegisterDao class.

3) Create the class to store data (

This class gets information from the object of RegisterAction class and stores these information in the strutsuser table.

4) Map the request in (struts.xml) file and define the view components

This xml file contains information about the package, action class and view components.


5) Create view components

Here, we are creating two view components register-success.jsp and register-error.jsp.


Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA