Hi Allen, Have a look at:
http://www.mail-archive.com/[email protected]/ Ted Husted posted a response to similar question(s) yesterday. Jon. -----Original Message----- From: Allen M. Servedio [mailto:[EMAIL PROTECTED]] Sent: 30 November 2001 13:01 To: [EMAIL PROTECTED] Subject: [REPOST FROM DEV] General Model Question... Hi, It was correctly pointed out to me that I had posted this to the wrong list (sorry about that folks!). So, I am posting this here in the hopes that some of you can help me: I have a couple of basic questions (I have only started using STRUTS, so if this is obvious please slap some links at me and send me on my way :-) ): Which object type are people having their Action's send into their business and/or data layers: ones that derive from ActionForm or ones that implement the Value Object pattern? And how are they converting the business and/or data layer's response back (into Action Forms? or are you sending back the Value Object so that the custom tags can use that?). My initial feeling on this was to only send Value Objects to the business and data layers so that they would not get coupled to what is obviously a presentation layer object (I saw Actions as bridges between the layers, converting between the Action Forms and Value Objects and back again). The problem I hit was that I did not want to have to write a bunch of conversion code (see below) to create my Value Object (since it is immutable and, hence does not have the setValue(object) methods that automatic JavaBean conversion utilities need): MyValueObject val = new MyValueObject(converter.convert(form.getValue(), typeOfConversion)); Where the above code would take the String value from an ActionForm, convert it into the type needed, and pass it into the constructor for the Value Object. Hit the same problem running back the other way (from Value Objects to Action Forms). OR are people making their value objects mutable and maybe having them implement a read-only interface that the business and data layers use when interacting with or returning the object? OR are people passing in the ActionForm to the Value Object so that it can extract what it needs (are you fronting it with an interface?)? OR are people passing in a map of properties and their values to the Value Object for it to pick and choose what it wants? OR something else entirely...? When you are going back from Value Object to Action Form, how are you controlling the output format? I know that the Action needs to understand the format of the data that it would expect to receive from a submitted form... So, I am assuming that all formatting has to happen before it gets to the custom tag (the only exception being when it is writing data that will not come back through a form or query string). Is this what people are doing? Thanks! Allen -- 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]>

