You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Senthivel U S <se...@uaeexchange.com> on 2003/01/02 15:11:30 UTC
Prepopulating DynaActionForm
Greetings,
I am using DynaAction Form. I want to pre populate Form with multiple
rows. In the form property , I specified
<form-bean name="exampleForm"
type="org.apache.struts.action.DynaActionForm">
<form-property name="name" type="java.lang.String"/>
<form-property name="address" type="java.lang.String"/>
<form-property name="country" type="java.lang.String"/>
I want to prepopulate the form from database.
So what I have done is
ArrayList arraylist = new ArrayList();
For (int i = 0; i<count; ++i) {
DynaBean exampleForm = DynaActionFormClass.
getDynaActionFormClass("exampleForm").newInstance();
PropertyUtils.setSimpleProperty(exampleForm, "name", name);
PropertyUtils.setSimpleProperty(exampleForm, "customerNo",
address);
PropertyUtils.setSimpleProperty(exampleForm,
"beneficiaryNo", country);
arraylist.add(exampleForm);
}
request.setAttribute("exampleForm", arraylist);
Now what I want is , is it correct way of doing or any other better way
is there.
Pls help me.
Thanx,
Sen