Downside is though, trying to cram string request parameters into your DTO in your form before you validate them. Causes ugly exception messages on the browser.

On 03/18/2004 02:25 AM Robert Taylor wrote:
Well, I would say it depends. If I had a DTO ( a domain object) which had all the fields
I needed to display...including types like int, Date, boolean, etc... I would probably just
pass that along to the form bean and let view helpers like the Struts tags or JSTL render
the contents. With JSTL you can format Dates and numbers. I believe those tags leverage the
java.text.* package for formatting data.


If I needed to perform some specialized formatting which could not be done by
view helpers then I may just convert the necessary fields to Strings (maybe using BeanUtils)
format them, and populate my ActionForm.


If the view I needed of the data was not encapsulated in a single DTO, then you could retrieve multiple DTO objects and rendered them as described above or use a pattern described as Transfer Object Assembler which builds a custom DTO or a collection of customer DTO
objects which you could pass along to the ActionForm.


You can read more about Transfer Object Assembler here:
http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObjectAssembler.html

robert


-----Original Message-----
From: Nick Wesselman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 17, 2004 6:28 PM
To: Struts Users Mailing List
Subject: Re: action - delegate - facade


What about when simply displaying data on a page? Do developers typically copy data out of the domain object just to display it? (As opposed to using it w/ a form.)


The only issue I see is that you may end up introducing view helper methods to your model beans.

Nick

Robert Taylor wrote:


Adam, its frowned upon to pass a web tier object (XXXXActionForm) into the business
tier. I believe a widely used technique is to use BeanUtils to copy the properties

from the XXXXActionForm to a DTO (a Domain Object) which can be passed to the

business tier.

robert






--------------------------------------------------------------------- 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]




--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to