You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by André Faria <an...@mandic.com.br> on 2007/01/06 15:17:49 UTC
Validation Annotations
Hi People!!!
Is there a way to use Validation Annotations only for a method or always
for the action...
Example, if I have a action PersonAction with three methods:
public class PersonAction {
public void execute(){}
public void list(){}
public void save(){}
}
But I have to validate the user input only in method save what could I do?
Have a nice weekend,
Thank's for help,
André Faria
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validation Annotations
Posted by André Faria <an...@mandic.com.br>.
I tried to validate only the method save, so I puted the annotations on
the top of the save method signature, but when I called execute method
the validation erros appered.
André Faria
Laurie Harper escreveu:
> I haven't used this, but looking at the last example in the
> documentation it looks like there are two types of field-level
> annotation: property accessor annotations and action method
> annotations. I would guess that validations specified through property
> accessor annotations would always fire, whereas action method
> annotations would fire according to which method was actually called.
>
> Which type did you try using?
>
> L.
>
> André Faria wrote:
>
>> Yes, but thats didnt works...
>> If you specify the annotations on the method save for example... The
>> validation roles will be apllyied for the others methods too.
>> I am running Struts 2.0.3 with xWork 2.0.0 (06/01/2007)...
>>
>> Thank's
>> André Faria
>>
>>
>> cilquirm escreveu:
>>
>>> According to
>>> http://struts.apache.org/2.x/docs/validation-annotation.html
>>>
>>> you can specify annotations at the method level.
>>>
>>>
>>>
>>> André Faria-3 wrote:
>>>
>>>
>>>> Hi People!!!
>>>>
>>>> Is there a way to use Validation Annotations only for a method or
>>>> always for the action...
>>>>
>>>> Example, if I have a action PersonAction with three methods:
>>>>
>>>> public class PersonAction {
>>>> public void execute(){}
>>>> public void list(){}
>>>> public void save(){} }
>>>>
>>>> But I have to validate the user input only in method save what
>>>> could I do?
>>>>
>>>>
>>>> Have a nice weekend,
>>>> Thank's for help,
>>>> André Faria
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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: Validation Annotations
Posted by Laurie Harper <la...@holoweb.net>.
I haven't used this, but looking at the last example in the
documentation it looks like there are two types of field-level
annotation: property accessor annotations and action method annotations.
I would guess that validations specified through property accessor
annotations would always fire, whereas action method annotations would
fire according to which method was actually called.
Which type did you try using?
L.
André Faria wrote:
> Yes, but thats didnt works...
> If you specify the annotations on the method save for example... The
> validation roles will be apllyied for the others methods too.
> I am running Struts 2.0.3 with xWork 2.0.0 (06/01/2007)...
>
> Thank's
> André Faria
>
>
> cilquirm escreveu:
>> According to http://struts.apache.org/2.x/docs/validation-annotation.html
>>
>> you can specify annotations at the method level.
>>
>>
>>
>> André Faria-3 wrote:
>>
>>> Hi People!!!
>>>
>>> Is there a way to use Validation Annotations only for a method or
>>> always for the action...
>>>
>>> Example, if I have a action PersonAction with three methods:
>>>
>>> public class PersonAction {
>>> public void execute(){}
>>> public void list(){}
>>> public void save(){} }
>>>
>>> But I have to validate the user input only in method save what could
>>> I do?
>>>
>>>
>>> Have a nice weekend,
>>> Thank's for help,
>>> André Faria
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: Validation Annotations
Posted by André Faria <an...@mandic.com.br>.
Yes, but thats didnt works...
If you specify the annotations on the method save for example... The
validation roles will be apllyied for the others methods too.
I am running Struts 2.0.3 with xWork 2.0.0 (06/01/2007)...
Thank's
André Faria
cilquirm escreveu:
> According to http://struts.apache.org/2.x/docs/validation-annotation.html
>
> you can specify annotations at the method level.
>
>
>
> André Faria-3 wrote:
>
>> Hi People!!!
>>
>> Is there a way to use Validation Annotations only for a method or always
>> for the action...
>>
>> Example, if I have a action PersonAction with three methods:
>>
>> public class PersonAction {
>> public void execute(){}
>> public void list(){}
>> public void save(){}
>> }
>>
>> But I have to validate the user input only in method save what could I do?
>>
>>
>> Have a nice weekend,
>> Thank's for help,
>> André Faria
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
>
--
Atenciosamente,
*/André Faria/*
/BlueSoft Consultoria em Informática/
/Fone: [55 11] 5543-5406/
/Web: www.bluesoft.com.br/
//////
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validation Annotations
Posted by cilquirm <aa...@gmail.com>.
According to http://struts.apache.org/2.x/docs/validation-annotation.html
you can specify annotations at the method level.
André Faria-3 wrote:
>
> Hi People!!!
>
> Is there a way to use Validation Annotations only for a method or always
> for the action...
>
> Example, if I have a action PersonAction with three methods:
>
> public class PersonAction {
> public void execute(){}
> public void list(){}
> public void save(){}
> }
>
> But I have to validate the user input only in method save what could I do?
>
>
> Have a nice weekend,
> Thank's for help,
> André Faria
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Validation-Annotations-tf2930726.html#a8222219
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org