struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Kriger" <akri...@greaterthanone.com>
Subject RE: Best way to handle this in Struts/MVC ?
Date Thu, 12 Dec 2002 18:43:49 GMT
I put data storage beans that need to be displayed into the request or
session and use bean:write and logic:iterate on the JSP. I don't see the
sense in creating extra objects targeted to display; just keeping the
get/set methods generic (return a Date, not a formatted Date String) should
be enough.

For date formatting, I use the datetime custom tags for dates
(http://jakarta.apache.org/taglibs/doc/datetime-doc/intro.html) - a caveat
the format tag uses long values so if your obj has a method Date getDate()
the property in the tag should be "date.time" (which will call the Date
obj's getTime() method that returns a long).

For number formatting, I use my own custom tag (that wraps
java.text.DecimalFormat).

-----Original Message-----
From: Rick Reumann [mailto:maillist@reumann.net]
Sent: Thursday, December 12, 2002 13:17
To: Struts List
Cc: model struts
Subject: Best way to handle this in Struts/MVC ?


For all of my forms I have an appropriate DynaValidatorForm bean
defined in my struts-config file. This form eventually populates a
bean (Data Transfer Object) that corresponds to the form bean but with
the correct data types (ie java.util.Date birthDate vs String
birthDate ).

The question I have is when generating a List to display the beans is
it really that bad to use the actual Data Transfer objects beans in
the display (vs a List of the DynaFormBeans)? The reason I ask is it
seems like a lot of overhead to convert a Collection of data transfer
objects into a whole new collection of DynaFormBeans, especially if
the List is quite large. The problem though is if you use the DTOs you
have to code in those beans proper formats for displaying such things
as Dates.

How do others handle this situation?

Thanks,

--

Rick
mailto:maillist@reumann.net


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message