This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Validating Two Fields Match Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validating Two Fields Match " Watch "Validating Two Fields Match " New topic

Validating Two Fields Match

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I am trying to use validation to check if two fields contain the same password i.e. password and confirm password. I looked at the example on the struts site but I cant seem to get it to work. I keep getting a ValidationException error. Im using struts 1.2.4

In my validation.xml

<field property="password" depends="required,twofields">
<msg name="required" key="errors.required"/>
<msg name="twofields" key="errors.twofields"/>
<arg0 key="userForm.password"/>
<arg1 key="userForm.passwordconfirm"/>

In my struts-config.xml

<form-bean name="registrationDynaValidateForm"
<form-property name="password" type="java.lang.String"/>
<form-property name="confirmpassword" type="java.lang.String"/>

In validator-rule.xml I have

<validator name="twofields"
Thank you all
[ February 11, 2005: Message edited by: john mattucci ]
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

[ February 11, 2005: Message edited by: Marc Peabody ]

A good workman is known by his tools.
I agree. Here's the link:
subject: Validating Two Fields Match
Similar Threads
Struts two filed comparison
Struts Validator Framework: problem with Custom Validator
Struts Validation not working
Password length