Displaying error values with Struts Validator Framework

S

smrimell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,131
Latest member
IsiahLiebe
Top