struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject Re: Default action method for unmatched wildcard actions
Date Mon, 26 May 2014 11:16:03 GMT
> 
> I'm trying to define a generic/abstract action and extend or 
> instantiate it with specific actions.
> 
> Say a generic/abstract CRUDaction and have UserAction, InvoiceAction 
> etc... to instantiate/extend it.
> 
> I don't see the way to do this using Conventions. I believe it is 
> possible using wildcards. Using conventions I am forced to override 
> abstract methods using Action annotations. But probably I am wrong so, 
> please, let me know if I can use Conventions bearing in mind this 
> design approach.
> 


You can use java inheritance for your abstract CrudAction. Only concrete 
actions are used by struts. Whether you confiugre them via XML, convention 
or annotations does not matter.


E.g.:

public abstract class CrudAction extends ActionSupport {
        ...
}


@Action("users")
public class UserAction extends CrudAction {
        ...
}


In your URL you would just use "users.action".


Regards,
Christoph


This Email was scanned by Sophos Anti Virus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message