Hi Pedro,
with:
FormBeanConfig fbc = new FormBeanConfig();
fbc.setName("myForm");
DynaActionFormClass dafc =
DynaActionFormClass.createDynaActionFormClass(fbc);
DynaActionForm formBean = (DynaActionForm) dafc.newInstance();
formBean.set("property", businessObject.getProperty());
request.setAttribute("userPrefsForm",formBean);
//End
you can create a dynaBean.
i had the problem long time ago two.
why are willing to use dynaBeans for populating a JSP-Form-Page?
i use "ValueObjects" or "HelperBeans" instead, which i store in
request and with there properties the formfilds get filled to!
look
http://rollerjm.free.fr/images/ClassStruts1_1.gif
an nice diagramm :-)
greetings
Matthias
-----Original Message-----
From: Pedro Salgado [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 03, 2004 5:29 PM
To: Struts Users Mailing List
Subject: dynaform populate
Can anyone help me on this?
I am trying to pass a populated DynaActionForm to a JSP file and I
can't figure out how can I populate the form...
I have the following sequence:
- form A (name : gotoUserPrefsForm, id : String - user id)
- action ViewUserPreferences (uses form A)
- form B (name : userPrefsForm, severall attributes)
ViewUserPreferences {
/** @param form this is form A. */
... execute(..., form, ...) {
int id = FormUtils.getIntValue(form, "id");
UserPreferences prefs = service.getUserPreferences("id");
// here starts the problem!!!
// gets the form bean configuration
FormBeanConfig fc =
config.findFormBeanConfig(mapping.getName());
// this is supposed to be form B
DynaValidatorForm dynaForm = // how do I create a new instance
with the FormBeanConfig?...
dynaForm.set("background", prefs.getBackground());
request.setAttribute("userPrefsForm", dynaForm);
}
}
Any ideas?
Pedro Salgado
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]