Displaying error values with Struts Validator Framework  
Author Message
smrimell





PostPosted: 2007-1-7 21:31:00 Top

java-programmer, Displaying error values with Struts Validator Framework Hi,

I'm using the struts validator framework to validate an email address
in a form.
If the user enters an invalid email address (ie
invalidEmailAddress.com) I'd like to display the following error
message:-

"invalidEmailAddress.com is an invalid e-mail address"

However all I seem to be able to do with the validator framework is
output the following:-

"Email address is an invalid e-mail address"

with messageResources.properties and validator.xml set as follows:-

validator.xml:-
<form name="addressForm">
<field property="emailAddress"
depends="email">
<msg name="email" key="errors.email" />
<arg name="email" key="form.address.label.emailAddress" />
</field>
</form>

messageResources.properties:-
errors.email={0} is an invalid e-mail address.
form.address.label.emailAddress=Email address

I'm using <html:errors /> to output the error list in a jsp.

Is there any way to substitute the actual entered value into the
errors.email message using the struts validator framework? I know it
can be done in the validate() method of the ValidatorForm class but
it there method of simply using the validator framework?

Thanks in advance for your help.
smrimell.

 
relogout@gmail.com





PostPosted: 2007-1-8 19:07:00 Top

java-programmer >> Displaying error values with Struts Validator Framework i don't think it's possible except using validate() method