Ok...i think I found the solution.

The super class can provide annotations at the method level for multiple subclasses using the @Actions. If a subclass needs to add or diverge from common functionality provided by superclass method, they can override the method, however, the subclasses method will have to provide the annotation since
annotations are not inherited.



/robert

----- Original Message ----- From: "Robert Taylor" <rtay...@dtgresults.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Wednesday, April 21, 2010 8:44 AM
Subject: Struts2 annotations and superclass


Greetings,

We are converting from using Struts1 and XDoclet to Struts2 and Struts2 annotations.

We have a base action class which handles requests which displays grid style information. The super class is a template pattern which does a lot of the common heavy lifting and exposes a method "display" which is invoked by a name specified in the action configuration for the url.
Subclasses simply implement a method to retrieve a collection of objects.

What we have been doing is placing the XDoclet annotations in the subclasses which specified
the url and the method to invoke.

With Struts2, I don't see that this is possible using just the annotations.
It appears subclasses will have to override the superclass method just to bind a url. I don't see that the @Action annotation supports a "method" parameter or it may be possible.

The same problem will occur for our CRUD action super classes.
The subclasses will have to override the super class methods just to bind the method name to the url.

So, am I missing something? Is it possible to use Struts2 annotations such that subclasses don't have
to override super class methods simply to bind the method name to the url?

/robert


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

Reply via email to