On Sunday 26 April 2009 03:18:56 pm Andreas Joseph Krogh wrote:
> On Sunday 26 April 2009 08:29:57 pm Wes Wannemacher wrote:
> >
> > The @Action annotation is meant to point to methods, and you can do it
> > like -
> >
> > @Actions( {
> > @Action(/mynamespace/showuser),
> > @Action(/mynamespace/anotheralias)
> > })
> > public String execute() {
> > ...
> >
> >
> > That is what I thought you were looking for, if it's not I'm sorry, go
> > ahead and re-open, preferably against the Conventions plugin and make a
> > comment letting us know a bit more about what you're looking for (and
> > remember, patches are welcomed!).
>
> What I'm looking for is the above example but on the action-class itself,
> not on the individual methods. Any reason why the @Actions-annotation is
> not ElementType.TYPE in addition to ElementType.METHOD? The
> @Action-annotation is applicable to classes, but isn't respected it seems.
>
> If it'll bee accepted I'll be happy to provide a patch extending the
> @Actions-annotation to also be of ElementType.TYPE and make both @Actions
> and @Action work on action-classes aswell.
I don't know if it is going to be as easy as it appears. Action Mappings are
(behind the scenes) a logical mapping to a method on the class. The default
methods used are execute/input/etc. So, applying to the class-level may not
work the way you intend. Try adding the annotations at the method level, it'll
probably do exactly what you need.
-Wes
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]