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 R <ri...@myrealbox.com> on 2002/04/22 19:30:08 UTC

Where is it best to populate default form bean collections etc?

Sorry if I'm not to clear here but I'm really curious about the best design principle to use under struts in the following situation...

Say you want to set up a jsp form and on the form you have several select elements. Each set of select elements is created dynamically from a query to the database. I have a corresponding form bean that goes with this page.

The question I have is it ok to set up the default select lists inside the form bean by calls to some other business logic? For example...

private dogsArray = business.getDogsArray();

then your normal set and get method.

I tend to thin this probably isn't a good idea and it would be best to have some action class create the array and then call the appropriate form bean set method. I'm not sure though.

Then what about when the form is reset, I take it you just make another call to the default action that sets up your form bean? I noticed in some of the examples they have a reset() method inside the form beans which goes and sets the fields to default values. This is why I began questioning the best practices, since if I follow that route than I really would have to call some business logic to populate the String[] arrays for the select options in the form beans. 
Hopefully I'm making some sense.

Thanks for any advice.

Rick


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>