Hi, In my application I need to have my Actions and my DispatchActions. Each one of this actions must have the same base class in which I have common methods to both of them. My solution is to first declare an interface IGeneral in which I'm declaring the common methods, then create an implementation class,GeneralImpl.Next thind to do would be to create my base classes BaseAction and BaseDispatchAction and this two must implement IGeneral, and in their implementation they should delegate to a private static member of type GeneralImpl, which will handle this methods. Example: <code> public interface IGeneral{ public Connection getConnection() throws SQLException; ........... public User getUser(HttpServletRequest req); } </code>
Then I'm creating the implementation for this methods: <code> public class GeneralImpl implements IGeneral{ private ActionServlet servlet; public GeneralImpl(ActionServlet srv){ servlet = srv; } public Connection getConnection() throws SQLException{ //code here } ........... public User getUser(HttpServletRequest req){ //code here } } </code> Now I create the base Actions <code> public abstract class BaseAction extends Action implements IGeneral { private static GeneralImpl general; public BaseAction (){ general = new GeneralImpl(servlet); } public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){ return executeAction(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) } public abstract executeAction(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response); public Connection getConnection() throws SQLException{ return general.getConnection(); } public User getUser(HttpServletRequest req){ return general.getUser(req); } } </code> The same for the DipatchAction. The question is anoybody has used something like this ? It this a good thing to do it ? Tanks in advance and sorry if the text it's too long Ovidiu --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]