aspose file tools*
The moose likes Struts and the fly likes how to check two fields are similar in struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to check two fields are similar in struts?" Watch "how to check two fields are similar in struts?" New topic
Author

how to check two fields are similar in struts?

shahidrasul shahid
Ranch Hand

Joined: Jan 28, 2008
Posts: 62
i has a form for password change.

i check that new password field and confirm new password field has equal values or not in automatic validation in struts.


any one tell me what am i do for this checking.
i am waiting , thanks advance.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There are two ways you can accomplish this:

Method 1: override the validate method on your form bean. In that method, you would first call super.validate() to perform the validation framework validations, and then write your own logic to compare the two fields.

Method 2: Create your own validation rule that compares two field. Fortunately for you, the Struts Validator Guide provides an example of the very thing you're trying to do in the section entitled Pluggable Validators.


Merrill
Consultant, Sima Solutions
shahidrasul shahid
Ranch Hand

Joined: Jan 28, 2008
Posts: 62
thanks my problem is solve by validwhen validator.
 
jQuery in Action, 2nd edition
 
subject: how to check two fields are similar in struts?