You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Reumann <r...@reumann.net> on 2003/06/07 07:22:09 UTC

Re: Is it better to return list of formbeans or list of objects created by torque?

On Thu, Jun 05,'03 (05:59 PM GMT-0400), Vic wrote: 

> What I do is my BaseFormBean implements a collection.
> 
> So it's both!
> It has getters/setters.
> When iterator or next() is called it goes to the next item in list. 
> Because it simplifies, it makes more complex designs possible.

I should point out that Vic's beans designed this way still DO NOT tie
the Struts beans to the business layer. At first I simply assumed that
they would, but they really do not at all. That's an important point
to make because you don't want to really be passing your Struts beans
around to business objects. The Form beans do have a DAO which is a link
to the business layer, but this DAO is independent of Struts. It's a
very cool design(IMO:). 

Most seem to insist that your Struts FormBeans be converted to something
like a DTO first and then that beans gets passed to the business layer
and going the other direction you return DTOs from the business layer.
Actually that's the pattern my lessons show at
http://www.reumann.net/struts/index.jsp. I actually now think that step
of converting your form beans to a DTO is pretty much a waste of time
(and processing). I'm sure someone will come up with some complex EJB
distributed scenario where you need a DTO, but I haven't run across this
situation. 

-- 
Rick


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