You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Ford <df...@smart-soft.com> on 2003/04/06 22:45:37 UTC

Re: Pre-populating DynaActionForm Bean (solved)

> Should use the following way to instantiate a DynaActionForm:
>
> DynaBean form =
> DynaActionFormClass.getDynaActionFormClass("accessory").newInstance();
>
> But surprisingly i can't find this method on the API on the Docs on the
> struts website. http://jakarta.apache.org/struts/api/index.html

Maybe I'm missing something. But I thought the primary purpose of the form
bean was to re-populate forms, but also to POPULATE forms (without the re).
How can one do this without the being able to create a DynaActionForm
instance? My understanding is that almost every struts application would
need this capability. For example: grab data from a database to populate a
form.

Thus, the fact that this is an undocumented method and not used in the
struts example application, leads me to believe my understanding is wrong.
How would one grab data from a database and use that data to populate a form
in struts?

Thanks.

Dave Ford
Smart Soft - The Developer Training Company
http://www.smart-soft.com



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


Re: Pre-populating DynaActionForm Bean (solved)

Posted by Dan Allen <da...@mojavelinux.com>.
> Thus, the fact that this is an undocumented method and not used in the
> struts example application, leads me to believe my understanding is wrong.
> How would one grab data from a database and use that data to populate a form
> in struts?

You request an action mapping, such as

/EditAccount

and in that Action (EditAccountAction), which is passed a reference
to your form, you use BeanUtils.copyProperties or whatever to
transfer the data into your form and then you forward to your form
page.  Then you submit it and do the reverse on an action like

/SaveAccountChanges

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Microsoft is not the answer, it is the question. 
The answer is NO!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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