Displaying error values with Struts Validator Framework

Discussion in 'Java' started by smrimell@gmail.com, Jan 7, 2007.

  1. Guest

    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.
     
    , Jan 7, 2007
    #1
    1. Advertising

  2. Guest

    i don't think it's possible except using validate() method
     
    , Jan 8, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sergio

    Validator Struts Framework

    Sergio, May 3, 2004, in forum: Java
    Replies:
    0
    Views:
    435
    Sergio
    May 3, 2004
  2. aerotops
    Replies:
    0
    Views:
    325
    aerotops
    Feb 22, 2006
  3. aerotops
    Replies:
    1
    Views:
    426
    raavi
    Feb 24, 2006
  4. Replies:
    4
    Views:
    918
    Richter~9.6
    Feb 13, 2007
  5. Prashant

    Struts Validator Framework

    Prashant, Mar 15, 2007, in forum: Java
    Replies:
    1
    Views:
    336
Loading...

Share This Page