struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <Wendy.Sm...@asu.edu>
Subject RE: How do I populate a DynaValidatorForm?
Date Thu, 25 Sep 2003 21:27:53 GMT
Barry Volpe wrote:
> With an Action Form we do the following:
> form = new UserForm();
> form.setUserid("5"); 
> What is the equivalent for a DynaValidatorForm?????
> Let's say my DynaValidatorForm is myForm
> Of course this does not work (compiler does not know what myForm
is.)....
> DynaValidatorForm dynaForm = (DynaValidatorForm)myForm; 
> myForm.setUserid("5");

http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna
_action_form_classes

"DynaActionForms are not a drop-in replacement for ActionForms. If you
need to access ActionForm properties in your Action, you will need to
use the map-style accessor, like myForm.get("name"). If you actively use
the ActionForm object in your Action, then you may want to use
conventional ActionForms instead."

I populate mine largely with BeanUtils.copyProperties(...).  If you need
to address a specific property, you can use the Map contained within the
DVForm:

> DynaValidatorForm dynaForm = (DynaValidatorForm)myForm; 
> myForm.setUserid("5");

2nd line becomes:
myForm.set("userid","5");

http://jakarta.apache.org/struts/api/org/apache/struts/validator/DynaVal
idatorForm.html

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM 


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


Mime
View raw message