The Remarkable Everyday

Struts for validation field in JSP

Posted by leejeok on May 8, 2008

One of the reasons to use Struts is the capabilities to validate the entries of data which pass from the user input. The validation process will be code within the ActionClass and pass it back to the ActionForm class. 

Generally, ActionForm:
1. encapsulate the data from the View to be transafer to the Controller.
2. having the getter and setter method to allow input to be mapped from the JSP.
3. having the validate() method which will perform the validation process.
3. represent as VIEW components within the MVC design pattern.
In other word, ActionForm Bean Populating the view, Provide Input to Action class, and Perform Validation.

Generally, the ActionClass:
1. Represent as the Controller components. Serve as the bridge to communicate between View and Model components.
2. Contain the execute() method which will interface with Model for business process and forward the control to View to display.

I have a sample of program which will only perform the validation process.  Click Here.

After processing the validation, the ActionClass will redirect to the proper page and this will be explain on the next blog.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: