Very true John. I think the dependency in the decision is at what layer in his application these responsibilities belong to. If it's business logic, then yes, do a Util class for your business logic, but if it's what I would call a "means" or a utility for your presentation layer or struts code, then do a filter-- like getting a connection.
| -----Original Message----- | From: John Espey [mailto:[EMAIL PROTECTED]] | Sent: Thursday, January 30, 2003 5:51 PM | To: Struts Users Mailing List | Subject: RE: one desing question, need help | | indeed, filters do rock. The only thing I would consider is that you're | going to lose type safety, and you're going to be using either the request | or the session as the pipe between the filter and the action. This may | not | be a bad thing, but consider which of these you'd rather see: | | Connection conn = (Connection)request.getAttribute("Connection"); | | | or | | Connection conn = MyUtil.getConnection(connProperties); | | I think either one is acceptable personally, but the intent of the util | class is more easily apparent. (The dependency is self documenting, | whereas | with the filter it isn't necessarily as easy to know from where the | connection comes) | | | | | | -----Original Message----- | From: Jacob Hookom [mailto:[EMAIL PROTECTED]] | Sent: Thursday, January 30, 2003 5:42 PM | To: 'Struts Users Mailing List' | Subject: RE: one desing question, need help | | | Or, you could do a filter that would setup the connection and properties | in | the request to these actions, then after they are done, return the | connection or close it, and essentially clean up whatever you created. | | "Filters Rock!" | - Area Culligan man | | | -----Original Message----- | | From: John Espey [mailto:[EMAIL PROTECTED]] | | Sent: Thursday, January 30, 2003 5:35 PM | | To: Struts Users Mailing List | | Subject: RE: one desing question, need help | | | | Just write a singleton class with methods that take the appropriate | | parameters, and have both actions delegate to that class. Then any | other | | classes can use those services also. | | | | -----Original Message----- | | From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] | | Sent: Thursday, January 30, 2003 5:30 PM | | To: [EMAIL PROTECTED] | | Subject: one desing question, need help | | | | | | Hi, | | | | I want to write 2 classes , one class say MyAction | | extends Action and the other class say | | MyDispatchAction extends DispatchAction. | | I want to have some code ( like setting some | | parameters or getting connection from pool) handled in | | both the classes, but i want to write it in such a way | | that i dont have to code all the common methods in | | both classes. | | I dont want to have one class which extends | | DispatchAction, because DispatchAction needs parameter | | as required field in struts-config file. | | | | This way i would be reducing my coding and future | | maintenance, since if there is any modification i can | | do it at only one place and will be applicable to both | | places | | | | Any suggestions are welcome | | | | | | | | | | | | | | | | ===== | | A$HI$H | | | | __________________________________________________ | | Do you Yahoo!? | | Yahoo! Mail Plus - Powerful. Affordable. Sign up now. | | http://mailplus.yahoo.com | | | | --------------------------------------------------------------------- | | 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] | | | --------------------------------------------------------------------- | 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]