In Struts, you may want or have the need to use more than one "type" of Action to process your requests. If you are sure you will only use one Action throughout the lifecycle of your application, then yes, place common operations in a base class. If you are not sure and your application leverages multiple Action types (Lookup, Dispatch, Mapped, etc...), then I would suggest you create a utility class containing the common behavior and share that among the various action types.
robert > -----Original Message----- > From: Ciaran Hanley [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 30, 2004 6:25 AM > To: 'Struts Users Mailing List'; [EMAIL PROTECTED] > Subject: RE: Reusing methods across actions classes > > > My actions already extend Action. Should I write a superclass that extends > Action, and then extend this class, is that correct? > > Thanks. > > -----Original Message----- > From: Mark Benussi [mailto:[EMAIL PROTECTED] > Sent: 30 September 2004 11:19 > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: RE: Reusing methods across actions classes > > I would say that if you have common functionality such as a method that all > objects [Actions] share then place the common method in a super class > [Action] that the other classes can extend. > > ----Original Message Follows---- > From: "Ciaran Hanley" <[EMAIL PROTECTED]> > Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > To: "Struts User Mailing List" <[EMAIL PROTECTED]> > Subject: Reusing methods across actions classes > Date: Thu, 30 Sep 2004 11:16:20 +0100 > > Hey, > > > > Bit of a dummy question here but I am wondering what is the best way to > reuse methods across different action classes. Is it acceptable to make an > instance of an action class within an action class so I can use one of its > methods. Or would it be better to simply copy and paste the method into the > both classes. Or should I extract all common methods into one class and > create an instance of this class as required. Any suggestions? > > > > CH > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]