just a work-around I came to think of:

if you’re building with maven or ant, why not generate the validation.xml-files 
from a home made xml configuration file using xxl(t)?

such tasks are built-in in ant and for maven there’s the xml-maven-plugin. 
generate the files into the generated classes dir and presto.

just my 2c
mats



> Från: Lukasz Lenart <lukaszlen...@apache.org>
> Ämne: Re: Grouping same type validators
> Datum: 5 maj 2014 10:17:09 CEST
> Till: Struts Users Mailing List <user@struts.apache.org>
> 
> 
> It isn't supported and I don't see simple way to achieve this.
> 
> 2014-05-03 23:33 GMT+02:00 Antonio Sánchez <ads...@gmail.com>:
>> Hello.
>> 
>> in a middle sized application there may be hundreds of required fields, and
>> maybe dozens of some other validator type, which are all very verbose to
>> define.
>> 
>> For instance: guess a big form with many required fields:
>> 
>>    <validator type="requiredstring">
>>        <param name="fieldname">person.firstName</param>
>>        <message>First name is required.</message>
>>    </validator>
>>    <validator type="requiredstring">
>>        <param name="fieldname">person.lastName</param>
>>        <message>Last name is required.</message>
>>    </validator>
>>    ... same for age...
>>    ... same for manymor...
>> 
>> This is repeating the same pattern for both defining the validator and the
>> corresponding message.
>> 
>> Is it possible to abbreviate to something like (pseudo-language):
>> 
>>    <validator type="requiredstring">
>>        <param name="fieldname">person.lastName, person.lastName,
>> person.age, person.manymore</param>
>>        <message>[MATCHED_FIELDNAME] is required.</message>
>>    </validator>
>> 
>> or
>> 
>>    <validator type="requiredstring">
>>        <param name="fieldname">person.lastName, person.lastName,
>> person.age, person.manymore</param>
>>        <message key="requiredField" />
>>    </validator>
>> 
>> and 'global.properties' having
>> 
>>    requiredField = [MATCHED_FIELDNAME] is required.
>> 
>> Thank you.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to