I think annotations give you more flexibility than XML .

ex : if an Action has multiple methods and only certain fields are
tied to each method, we can bunch together validations for each method
using annotations, but this is not possible using XML

On 8/15/07, Laurie Harper <[EMAIL PROTECTED]> wrote:
> David Copeland wrote:
> > I'm a Struts newb and am trying to get up to speed on Struts 2.
> >
> > The scant documentation is throwing me a bit; I'm trying to do
> > everything annotation-based, and for Validation, it seems to be simply
> > not working at all.
> >
> > Per the docs, I have tagged my action class with @Validator and tagged
> > my setXXX method with @RequiredFieldValidator.
> >
> > My form's JSP contains <s:fielderror><s:param>XXX</s:param></s:fielderror>.
> >
> > When I submit the form with no value for XXX, my execute method
> > executes as it would before I added the validation stuff.
> >
> > I would really like to avoid XML files, but it seems that if I'm using
> > annotations, everything needs to be done that way.
>
> I'm not sure what that last paragraph means; you can certainly use XML
> validation for one action and annotations in another. I'm not sure to
> what extent it's possible to mix XML and annotation based validation in
> the *same* action, but there's certainly no requirement to pick one or
> the other for the application as a whole.
>
> It may help if you post the relevant parts of your config, JSP and
> action code. There are several 'moving parts' involved in making
> validation work, and it's hard to guess where the problem is without
> seeing what you have done.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to