You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jerry Jalenak <Je...@LABONE.com> on 2003/05/14 22:34:40 UTC

Instantiating and Using DynaValidatorActionForm

I have a case where I need to pre-populate a DynaValidatorActionForm in a
setup action, display the form, the process the users input.  I'm using the
following to instantiate the DynaValidatorActionForm:

		ModuleConfig mc = (ModuleConfig)
request.getAttribute(Globals.MODULE_KEY);
		FormBeanConfig fbc = mc.findFormBeanConfig("UserDetail");
		DynaActionFormClass dafc =
DynaActionFormClass.createDynaActionFormClass(fbc);

How to I set the values for the <form-property> fields under the form bean?
I've tried to use BeanUtils.copyProperties, nothing seems to be getting set
(nothing shows up on the JSP).  Also, in what scope do I set the
instantiated bean?  request or session?

TIA!

Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

jerry.jalenak@labone.com


This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: securityincidentreporting@labone.com



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


RE: Instantiating and Using DynaValidatorActionForm

Posted by Robert Taylor <rt...@mulework.com>.
Jerry, allow Struts to create the form bean for you, then
all you have to do is populate the form in your setup action.

DynaBean theForm = (DynaBean) form;

theForm.set("someProperty", someValue);

or use BeanUtils.

MyDTO dto = // get DTO
Map description = BeanUtils.describe(dto);
BeanUtils.populate(theForm, description);

Make sure the DTO properties match the form properties.


robert

> -----Original Message-----
> From: Jerry Jalenak [mailto:Jerry.Jalenak@LABONE.com]
> Sent: Wednesday, May 14, 2003 4:35 PM
> To: 'struts-user@jakarta.apache.org'
> Subject: Instantiating and Using DynaValidatorActionForm
> 
> 
> I have a case where I need to pre-populate a DynaValidatorActionForm in a
> setup action, display the form, the process the users input.  I'm 
> using the
> following to instantiate the DynaValidatorActionForm:
> 
> 		ModuleConfig mc = (ModuleConfig)
> request.getAttribute(Globals.MODULE_KEY);
> 		FormBeanConfig fbc = mc.findFormBeanConfig("UserDetail");
> 		DynaActionFormClass dafc =
> DynaActionFormClass.createDynaActionFormClass(fbc);
> 
> How to I set the values for the <form-property> fields under the 
> form bean?
> I've tried to use BeanUtils.copyProperties, nothing seems to be 
> getting set
> (nothing shows up on the JSP).  Also, in what scope do I set the
> instantiated bean?  request or session?
> 
> TIA!
> 
> Jerry Jalenak
> Team Lead, Web Publishing
> LabOne, Inc.
> 10101 Renner Blvd.
> Lenexa, KS  66219
> (913) 577-1496
> 
> jerry.jalenak@labone.com
> 
> 
> This transmission (and any information attached to it) may be 
> confidential and is intended solely for the use of the individual 
> or entity to which it is addressed. If you are not the intended 
> recipient or the person responsible for delivering the 
> transmission to the intended recipient, be advised that you have 
> received this transmission in error and that any use, 
> dissemination, forwarding, printing, or copying of this 
> information is strictly prohibited. If you have received this 
> transmission in error, please immediately notify LabOne at the 
> following email address: securityincidentreporting@labone.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 

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