Matthew E.Porter wrote:
I am in the process of converting JLCP from some other, unnamed framework (cough... cough.. Struts) to Webwork2 and would like to solicit some feedback from those who using Webwork2/XWork. Right now, I am working on our Poll Module and see two possible roads to take for implementing business logic.

The first route is to implement the business logic in a separate class, for example PollManager. Actions are then used to bridge the web frontend and call methods on the class. Every action that needs PollManager could retrieve it via IoC.

The second route would be to implement the logic inside Actions. In this case, actions would have direct access to the core components, such as the PersistentManager to perform CRUD operations.

Any suggestions and/or opinions?

I would definitely go the first route. I think what you'll find with using IoC is that you'll be more inclined to make finer grained business logic objects where objects will commonly have multiple depdendencies. Placing your business logic in Actions limits this as the action is really the end of the road as it gets really bulky to try to use Actions as components.


Also, it's a lot easier to replace your business logic if they're in components rather than Actions.

The only issue that I came across is handling of the database connection. Initially, I took the route of making all my components request level objects, but since the only thing that need the request lifecycle was the database connection, i pulled it out into a ThreadLocal and was able to put everything into the application context at that point.

M




------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to