You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lukasz Lenart <lu...@apache.org> on 2013/07/10 15:17:58 UTC

Re: Global Validation

2013/7/10 Alireza Fattahi <af...@yahoo.com>:
> Hi,
>
> Are there Global Validation  in struts 2 ?!

What you mean by that? Validations which affects each and every
action? If so, no.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Re: Global Validation

Posted by Lukasz Lenart <lu...@apache.org>.
Nope, but you can use expressions:

http://struts.apache.org/development/2.x/docs/validation.html#Validation-LocalizingandParameterizingMessages


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2013/7/11 Alireza Fattahi <af...@yahoo.com>:
> Hi,
>
> Well I mean is there a way which I can tell the validation frame work that all "required string"  validations should display this message
> <message> The ${TheFiledWhichFailed} must be a string </meesage>
> And then I define:
> <validator type="requiredstring">
>     <param name="fieldName">Username</param>
> </validator>
> <validator type="required">
>     <param name="fieldName">Address</param>
> </validator>
>
> So when the validation fails it generates:
> The username must be string.
> The address must be string.
> .....
>
>
> Or should I do it:
> <validator type="requiredstring">
>     <param name="fieldName">Username</param>
>     <message>Username must be string.</message>
> </validator>
>
> <validator type="required">
>     <param name="fieldName">Address</param>
>     <message>Address must be string.</message>
> </validator>
>
>
>
> ~Regards,
> ~~Alireza Fattahi
>
>
> ________________________________
>  From: Lukasz Lenart <lu...@apache.org>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Sent: Wednesday, 10 July 2013, 16:47
> Subject: Re: Global Validation
>
>
> 2013/7/10 Alireza Fattahi <af...@yahoo.com>:
>> Hi,
>>
>> Are there Global Validation  in struts 2 ?!
>
> What you mean by that? Validations which affects each and every
> action? If so, no.
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> 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: Global Validation

Posted by Alireza Fattahi <af...@yahoo.com>.
Hi,

Well I mean is there a way which I can tell the validation frame work that all "required string"  validations should display this message 
<message> The ${TheFiledWhichFailed} must be a string </meesage>
And then I define:
<validator type="requiredstring"> 
    <param name="fieldName">Username</param> 
</validator> 
<validator type="required"> 
    <param name="fieldName">Address</param> 
</validator> 

So when the validation fails it generates: 
The username must be string.
The address must be string.
.....


Or should I do it:
<validator type="requiredstring"> 
    <param name="fieldName">Username</param> 
    <message>Username must be string.</message> 
</validator> 

<validator type="required"> 
    <param name="fieldName">Address</param> 
    <message>Address must be string.</message> 
</validator> 

 

~Regards,
~~Alireza Fattahi


________________________________
 From: Lukasz Lenart <lu...@apache.org>
To: Struts Users Mailing List <us...@struts.apache.org> 
Sent: Wednesday, 10 July 2013, 16:47
Subject: Re: Global Validation
 

2013/7/10 Alireza Fattahi <af...@yahoo.com>:
> Hi,
>
> Are there Global Validation  in struts 2 ?!

What you mean by that? Validations which affects each and every
action? If so, no.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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