struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Michel Garnier <>
Subject RE: Validation and errormessage?
Date Wed, 24 Sep 2003 10:27:07 GMT
This point has been raised many times in the struts users mailing list (you
can search in the list with

I forward you my reply to Daniel who had the same problem as us one week
ago. I was suggesting to collaborate in order to find an elegant solution
which could be included in the Struts Validator.

Anyone interested ?


We want to do exaclty the same. After many attempts, it seems that Struts
1.1 Validator does not provide this functionality.

It seems that there will be an evolution in Struts 1.2 with the validwhen
validator, see :
"Designing Complex Validations with validwhen",

We are (will be) using intensively the Struts Validator and we do need this
feature as soon as possible.
If there are other people interested, maybe we can work together on the

First, let's write a short technical spec document, write a test class and
then implement it !
As far I am concerned, we just need to extend FieldChecks to add the value
of the field in the ActionError.

Let me know what you think.


> -----Original Message-----
> From: Daniel Wang []
> Sent: 16 September 2003 22:13
> To: Struts Users Mailing List
> Subject: validator question: show value of a field in error
> I asked this earlier and did not receive any response, so 
> i'll post it one
> more time with more supporting info...
> In validation.xml, how do I show the value of the offending 
> field in the
> error message as
> opposed to the field name?
> i.e. if the field I want to validate is email, and the user 
> types in "foo",
> how do I show
> "'foo' is not a valid email address"
> as opposed to the more standard (or widely documented) error
> "'Email Address' is not valid"
> In my current validation.xml, here's the relevant portion:
>               <field property="email"
>                      depends="required,email">
>                   <msg
>                     name="required"
>                     key="errors.required"/>
>                   <msg
>                     name="email"
>                     key=""/>
>                   <arg0 key=""/>
>               </field>
>  Thanks,
> Daniel

> -----Original Message-----
> From: Terje Hopsø []
> Sent: 24 September 2003 10:22
> To: Struts Users Mailing List
> Subject: Validation and errormessage? 
> Hello,
> In my validation.xml I have the folowing:
>    <form name="nySkytterForm">
>      <field property="epost"
>        depends="required,email">
>         <arg0 key=""/>
>      </field>
>    </form>
> This works fine and the value from the "" 
> is found in the
> resources file. But I would like to have the value of the fields in my
> errormessage as well, is that possible? And if it is, how?
> - Terje

This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit

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

View raw message