Personally I like to use two kind of data object, one that contains all screen datas ( ViewDataObject ) and an other one that comes from the persistence layer ( PerDataObject ). My Action class receive the ViewData object and if needed copy datas to the ActionForm. This permit to separate pure application development from the GUI development with Struts.
In resume I have the followings class: 1) Persistence Layer contains PerData object: They are mapped to a table of my Database and have only getter and setter methods. Per object (Actually they are not EJB, sorry): They contains my JDBC transactions, with the followings methods save(), delete(), findByPrimaryKey() and findAll(). All methods receive PerDataObject. 2) Presentation layer: ViewData object: Are mapped to a screen of my application and have only getter and setter methods. Controller object: They aggregate if needed, PerData object and do some presentation manipulation. The Controller object is used by the Action class. For the business layer, if you need one, you can create Bus object and BusinessData object. Your presentation layer will receive BusData object. The other solution is to use your Business object directly into the Controller. If you are using EJB's for the persistence layer, i suggest you to add a Connector object between layers or use the Proxy Pattern. Certainly my pattern is not perfect, but we develop in this way sufficiently fast and the code is reusable. I will appreciate any comment, suggestion to improove, this design pattern. Regards -----Message d'origine----- De : Vikram Goyal01 [mailto:[EMAIL PROTECTED]] Envoy� : mercredi, 13. mars 2002 09:52 � : Struts Users Mailing List Objet : RE: Use of stuts in J2EE Hi Dave, Thanks for that info. I have one question. When your formbean captures the data that the user has submitted, how do you pass this data to the app layer? If you pass the same form bean, then your app layer is not usable by other clients (or they will also have to implement struts). Basically my question is, how do you process your form bean into a data object? If you create another data object at this point, isnt that a performance overhead? Rgs Vikram -----Original Message----- From: Dave J Dandeneau [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 10:10 AM To: [EMAIL PROTECTED] Subject: RE: Use of stuts in J2EE We are currently implementing a j2ee / struts project. If I had any advice to you it would be to make sure you read up about common j2ee patterns. They can save you a lot of time and help you avoid some of the common EJB problems. We are using a command pattern which works very well. It is similiar to a session facade pattern where there are session beans that run all of the logic on the ejb container and send only the results back to the actions. This helps reduce network overhead, and makes transactions very simple. There are a million different patterns out there, and the most common ones are available at Sun's site: http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/ Other than that I don't think that working with struts and EJBs is much different than working with EJBs on a non-struts application. Thanks, dave dandeneau -----Original Message----- From: Vikram Goyal01 [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 12, 2002 10:50 PM To: [EMAIL PROTECTED] Subject: Use of stuts in J2EE Hi all, I am implementing a J2EE (Enterprise application with EJBs) project using struts. If anyone has done a similar project and would like to share some guidelines please mail back to me. Alternatively, if you have any online pointers, articles etc. please forward these as well. Regards Vikram Goyal -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

