struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeff kyser <>
Subject Problem with name displayed in error message for custom validator
Date Tue, 18 Feb 2003 13:23:46 GMT
Hello all,

I've given this one a pretty good effort, having hacked at it a while,
looked at the lists, read the chapters from several of the books, and 
don't seem to have it quite right.

I set out to write my own custom validator, using the example of 
to make sure when a new user is added, the confirmation matches the 

I put the following in my application resources file, to identify my 
three fields:
username, password, confirm:

	# userForm fields
	userForm.username.displayname=User Name

I've got all the validator-specific messages in a separate bundle,, and the one of interest to me here is:

	errors.identical={0} must be identical to {1}.

I've implemented it in an (add) user form, where I would expect a 
message such as:

	"Confirm must be identical to Password"

to appear when the confirmation doesn't match the  password as a new 
user is being added.

Here's my form details in my validation.xml file:

         <form name="userForm">
             <field property="username" depends="required">
                 <arg0 key="userForm.username.displayname"/>
             <field property="password" depends="required">
                 <arg0 key="userForm.password.displayname"/>
             <field property="passwordConfirm" depends="identical">
                 <arg0 key="userForm.confirm.displayname"/>
                 <arg1 key="${var:identicalTo}" resource="false"/>

So, passwordConfirm depends on the "identical" rule which triggers
properly when the two values are not the same.

My problem/question is: have I set this up right? The reason I ask is 
instead of displaying the value of userForm.password.displayname 
it displays the plain "password" instead.

In other words, it appears to be displaying the 
instead of displaying the userForm's password displayname (Password).

Is that what I should expect? It doesn't seem so to me.  Have I set 
this up wrong,
or is that just "the way it works".



Oh, and for completeness, my jsp looks as follows with respect to the 

	<html:password property="passwordConfirm"/>
          <html:errors property="passwordConfirm"

(The rule fires properly, a message comes up, it just isn't the one I 
expected :)

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message