struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hedju Hor"<hedjuh...@gmail.com>
Subject Re: Annotation validation setter level
Date Sat, 06 Jan 2018 10:37:38 GMT
Hi, use  @VisitorFieldValidator
1. in Action-Class annotad gettter Method of the model with @VisitorFieldValidator
2. @EmailValidator on getter in Model Person.getEmail

see 
https://depressedprogrammer.wordpress.com/2007/05/10/struts-2-validation-using-annotations/

Regards
Hedju Hor

On 2018-01-05 19:50, José Antonio Delgado Trujillo <jadtmat@gmail.com> wrote: 
> Annotations validations an alternative way of XML validation or the simplest way to implement
the validate method.
> 
> Yo have two options:
> At method level 
> At setter level
> 
> In the second if you don’t have the setter in the Action class because it is a property
of an object, where do i put the annotation. I think it would be in the model class but it
doesn’t work.
> 
> I explain better with a example.
> Person class have email property and the action class has a field of Person’s type.
So the setter method is for Person not for email. If i want to use @EmailValidator in a setter
level where does it put the annotation?
> 
> 
> Un saludo,
> José A.
> 
> 

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


Mime
View raw message