You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Vickery <sc...@virtual-systems.com> on 2005/12/20 18:40:23 UTC

ActionForm design question

I know this is a bit open-ended, but, here is goes.  I have a somewhat
complicated form.  It is the classic Order / OrderLine problem.  I have
an order, within it, there is >1 order lines.  The order lines are
arranged as a tree so that they can be grouped together by the user.
For each order line, there is a list of options that are different based
on what is being ordered.  I have all this populating via hibernate.
The orderlines and their list of options are stored as java.util.Map's.
I am displaying this information on a form directly from the hibernate
beans.  Now, it is time to allow the user to edit the information.  

 

I think that I should be populating a form bean from the hibernate bean
instead of using the hibernate bean directly.  Correct?  If so, what
should the bean look like?  The same as the hibernate bean?  Seems like
I am writing things down in 2 places.  Is there an easier way to do
this?  Should I be looking at DynaForms instead?

 

Thanks,

Scott

 

 

Virtual Systems International, Inc.
1400 Crescent Green / ste. 215
Cary, NC  27511

Phone:  (919) 319-0888
Fax: (919) 319-0884
scottv@virtual-systems.com
www.virtual-systems.com <http://www.virtual-systems.com/> 

 


Re: ActionForm design question

Posted by Laurie Harper <la...@holoweb.net>.
Scott Vickery wrote:
> I know this is a bit open-ended, but, here is goes.  I have a somewhat
> complicated form.  It is the classic Order / OrderLine problem.  I have
> an order, within it, there is >1 order lines.  The order lines are
> arranged as a tree so that they can be grouped together by the user.
> For each order line, there is a list of options that are different based
> on what is being ordered.  I have all this populating via hibernate.
> The orderlines and their list of options are stored as java.util.Map's.
> I am displaying this information on a form directly from the hibernate
> beans.  Now, it is time to allow the user to edit the information.  
> 
> I think that I should be populating a form bean from the hibernate bean
> instead of using the hibernate bean directly.  Correct?  If so, what
> should the bean look like?  The same as the hibernate bean?  Seems like
> I am writing things down in 2 places.  Is there an easier way to do
> this?  Should I be looking at DynaForms instead?

There was a long thread on this kind of stuff a day or two ago. 
Basically, yes, you need a form bean that has String properties for each 
input datum. You may want to make it look similar to the hibernate bean, 
but there's no need to do so. The form bean is modeling the set of 
inputs from an HTML form, so as long as it provides a slot for each 
datum (input item) it can be structured however you want.

DynaForms are a way of setting up form beans without having to write any 
code -- i.e. they're a declarative way of constructing form beans. 
They're definitely worth a look. While you're at it, have a look at 
LazyDynaActionForm and the FormDef project for other tools you may find 
useful in this context.

L.


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