S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread j alex
Hi, I am about to migrate a S1 app to S2 and need to decide which route to take regarding validations - XML or annotations? . Our app has a lot of custom validators involving rules dependent on multiple fields. Is there a specific benefit to using annotations vs XML ? Thanks, Joseph

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread Jeromy Evans
Hi Joseph, I haven't used annotation validation since S2.0.6 so these issues may be a little dated. These are my experiences: 1. I tend to use wildcards in actions. In this situation, annotations applied to properties in an action are not appropriate as not all validations apply for each

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread Musachy Barroso
On my current project I started using annotations, but very soon my few actions were packed with them, to the point that I had more annotations that actual code in my actions :), so I went the xml way. musachy On 8/7/07, Jeromy Evans [EMAIL PROTECTED] wrote: Hi Joseph, I haven't used

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread Kevin Lawrence
I started with annotations and wild-carded actions and I very quickly ran into the problem of not all fields apply to every action. I briefly considered switching to xml validations but decided instead to stick with one method per action. I hated the duplicate code in the actions and in

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread j alex
Thanks for your inputs. Kevin, can you please explain a bit more abt the provide a new annotation to enable/disable particular validations for particular methods -- are you saying that for certain actions (aka methods, i presume) you don't want the fields to be validated, but the validation

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread Dave Newton
--- j alex [EMAIL PROTECTED] wrote: My understanding is that the validators are tied to fields and not methods - right? They *can* be tied to the fields (in other words, every action method) but you can specify validations based on the action name as well. d.

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread Kevin Lawrence
I am a struts newbie so take my thoughts for what they are ... a newbie grappling with a new way of doing things. Maybe (I hope!) an expert will show me the error of my ways. A simple example: I wanted to put all the user properties on a UserAction that is shared by my 'create user' and

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread Ian Roughley
And you can place them on the domain objects and use a visitor validator ;) Dave Newton wrote: --- j alex [EMAIL PROTECTED] wrote: My understanding is that the validators are tied to fields and not methods - right? They *can* be tied to the fields (in other words, every action

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread j alex
Hi Ian, From the documentation, VisitorFieldValidator seems interesting. Can you please provide some inputs on if/how we can use this for the following scenario : the domain object Name has properties firstname, lastname, initial etc. now, Name could be associated with a primaryapplicant or a

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread Ian Roughley
The validation and the related messages are on the domain objects and not the action, so they are separate. Then the action defines which domain object is validated via the visitor validation - there is also a prefix (not sure of the exact attribute off hand), which would ensure that coapp or

Re: S2 : XML vs annotation validation - thoughts?

2007-08-07 Thread Kevin Lawrence
Here's a better example that I just ran into: I had getEmail() and getPassword() with @RequiredStringValidator on the base UserAction. When I came to test ResetPasswordAction (which only requires an email), my execute() method was never called but I got no field errors on the rendered page.