With some work, the annotations could be as flexible as the XML
validations. The messy problem in either case is being able to express
when and when-not to inherit validations from parent classes.

Right now, you can shut off the inheritance of validations (as
Veronica described), but it shuts off all inheritance, even "property"
validations" on parent classes. In turn, this is awkward since it can
be convenient to have one place to declare the format of a field (e.g.
email) whenever it is used.

In my own work, I'm getting away from aliases and tending to use more
classes. Where I might have used a class with multiple method before,
I've added a package with multiple classes. For now, this paradigm
seems to work better with the existing validation annotations.

Add in the ActionNames and ActionName annotations frrom the SmartURLs
plugin, and it becomes possible to write non-trivial Struts 2
applications using only conventions and annotations (connotations?) :)

It doesn't use multiple packages, but I have just finished a draft of
a Zero Configuration MailReader. There isn't any kind of a
distribution yet, but it can be obtained from SVN:

 * http://sq1-struts2.googlecode.com/svn/trunk/articles/mailreader-zero/

All the JARs are checked in, and it shouldn't be hard to import the
project into any given IDE.

Of course, there are many people who prefer to use multiple methods. I
expect that the annotations could be extended to better support action
aliases, but we need more volunteers to do the work.

HTH, Ted
<http://www.husted.com/ted/blog/>


On 9/18/07, David Harland <[EMAIL PROTECTED]> wrote:
> Hi Ted,
>
> It appears that if you use annotations you have more flexibilty than
> with using xml. Would it not be possible to add the abililty to specify
> validation files for each method without having to create aliases for
> every single method. We have actions with quite a high number of methods
> each wanting different validation. This can get messy.
>
>
> Regards
>
> David

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

Reply via email to