struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <hus...@apache.org>
Subject Re: Collection and form bean
Date Thu, 06 Jun 2002 16:38:03 GMT
You probably want there to be a collection of beans, and a helper method
on the bean that returns a blank instead of 0. Then all the JSP has to
do is call the helper, without having to know anything about the blank
or 0 requirement. 

In a case like this, whether the bean object itself was born in a model
package or controller package isn't pertinent. The page is only bound to
the property name, not the object. You could switch the bean object at
any time, and so long as the property name stayed the same, the page
would be none the wiser.

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services

Jayaraman Dorai wrote:
> 
> I have a collection of Value objects which I iterate through the logic iterate in JSP.
This value object has a int. The requirement is to display a blank instead of a 0. I can convert
this value object into a form bean which has a string equivalent for this int and replace
a 0 with an empty string. But the idea of iterating over a collection of form beans doesn't
sound well for me. Is that ok?
> 
> In the struts example, the collection of subscription is iterated and not the subscriptionForm.
If subscription had an int attribute would it be wise to iterate through the collection of
subscriptionForm. Which is more MVC? The jsp page iterating over the model object or the form
object.
> 
> Jayaraman

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