You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antonio Sánchez <ad...@gmail.com> on 2014/05/03 23:33:09 UTC

Grouping same type validators

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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Grouping same type validators

Posted by Antonio Sánchez <ad...@gmail.com>.
I don't think so.

That code validates a filed named person.lastNameAndFirstName for a 
sequence of blank separated words.

I'm asking for for an abbreviated syntax for defining required 
validations, or once for all defining validations that will be present 
all along the project.

MG><validators>
<!-- taxis simple validador ->
<validator type="regex">
<!-- se concatenan nombres ultima y espacio y primero -->
<param name="fieldName">person.lastNameAndFirstName</param>
<param name="regex"><![CDATA[([a-z][ ][a-z])]]</param>
</validator>
</validators>

El dom 04 may 2014 03:07:34 CEST, Martin Gainty escribió:
>
>
>
>>
>> Date: Sat, 3 May 2014 23:33:09 +0200
>> From: adsn37@gmail.com
>> To: user@struts.apache.org
>> Subject: Grouping same type validators
>>
>> 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>
>
>
> MG><validators>
> <!-- taxis simple validador ->
> <validator type="regex">
> <!-- se concatenan nombres ultima y espacio y primero -->
> <param name="fieldName">person.lastNameAndFirstName</param>
> <param name="regex"><![CDATA[([a-z][ ][a-z])]]</param>
> </validator>
> </validators>
> MG>¿funcionará para usted?
>
>>
>> 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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>

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


RE: Grouping same type validators

Posted by Martin Gainty <mg...@hotmail.com>.

> Date: Sat, 3 May 2014 23:33:09 +0200
> From: adsn37@gmail.com
> To: user@struts.apache.org
> Subject: Grouping same type validators
> 
> 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>

MG><validators>
      <!-- taxis simple validador ->
      <validator type="regex">
         <!-- se concatenan nombres ultima y espacio y primero -->
          <param name="fieldName">person.lastNameAndFirstName</param>
          <param name="regex"><![CDATA[([a-z][ ][a-z])]]</param>
     </validator>
    </validators>
MG>¿funcionará para usted?

> 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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  

Re: Grouping same type validators

Posted by Antonio Sánchez <ad...@gmail.com>.
Sorry, this is the right one:

https://issues.apache.org/jira/browse/WW-4340

El lun 05 may 2014 18:39:59 CEST, Antonio Sánchez escribió:
> https://issues.apache.org/jira/browse/WW-3993
>
> El lun 05 may 2014 13:34:51 CEST, Lukasz Lenart escribió:
>> Sure thing, but it will be rather postponed till 2.5
>>
>> 2014-05-05 13:31 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>>> Would it worth the while to post an enhancement request?
>>>
>>> El lun 05 may 2014 10:17:09 CEST, Lukasz Lenart escribió:
>>>>
>>>> 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 <ad...@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-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>

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


Re: Grouping same type validators

Posted by Antonio Sánchez <ad...@gmail.com>.
https://issues.apache.org/jira/browse/WW-3993

El lun 05 may 2014 13:34:51 CEST, Lukasz Lenart escribió:
> Sure thing, but it will be rather postponed till 2.5
>
> 2014-05-05 13:31 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
>> Would it worth the while to post an enhancement request?
>>
>> El lun 05 may 2014 10:17:09 CEST, Lukasz Lenart escribió:
>>>
>>> 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 <ad...@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-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: Grouping same type validators

Posted by Lukasz Lenart <lu...@apache.org>.
Sure thing, but it will be rather postponed till 2.5

2014-05-05 13:31 GMT+02:00 Antonio Sánchez <ad...@gmail.com>:
> Would it worth the while to post an enhancement request?
>
> El lun 05 may 2014 10:17:09 CEST, Lukasz Lenart escribió:
>>
>> 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 <ad...@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-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: Grouping same type validators

Posted by Antonio Sánchez <ad...@gmail.com>.
Would it worth the while to post an enhancement request?

El lun 05 may 2014 10:17:09 CEST, Lukasz Lenart escribió:
> 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 <ad...@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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: Grouping same type validators

Posted by Lukasz Lenart <lu...@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 <ad...@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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