Hi all
I have to instantiate a DynaActionForm/DynaValidatorForm, before it is used in page. My need is to pre-compilate some of it's property, so that the user does not have to fill in.
I try with the code:
DynaActionForm dynaForm = new DynaActionForm();
dynaForm.set("property",value);
...
I get a NullpointerException after set method!!
Does anyone can help me??
Thanks Aldo Funicelli
-
Initialize DynaActionForm (2 messages)
- Posted by: Aldo Funicelli
- Posted on: July 20 2004 10:46 EDT
Threaded Messages (2)
- Re:Initialize DynaActionForm by Piotr Maj on July 20 2004 14:21 EDT
- Re:Initialize DynaActionForm by Piotr Maj on July 20 2004 14:24 EDT
-
Re:Initialize DynaActionForm[ Go to top ]
- Posted by: Piotr Maj
- Posted on: July 20 2004 14:21 EDT
- in response to Aldo Funicelli
Hi,
a DynaForm need undelying dynaclass to work. If you want to initialize DynaForm
in struts action try something like this:
ModuleConfig module = context.getMapping().getModuleConfig();
FormBeanConfig formBeanConfig = module.findFormBeanConfig("formNameDefinedIn:struts-config.xml");
DynaActionFormClass dynaClass = DynaActionFormClass.createDynaActionFormClass(formBeanConfig);
DynaValidatorForm form = (DynaValidatorForm) dynaClass.newInstance();
this should help. At least it work form me. :-)
--
Piotr Maj -
Re:Initialize DynaActionForm[ Go to top ]
- Posted by: Piotr Maj
- Posted on: July 20 2004 14:24 EDT
- in response to Piotr Maj
ModuleConfig module = context.getMapping().getModuleConfig();
Sorry, this context is something specific for my project. In plain struts action
you get a mapping pointer in execute() method.
--
Piotr Maj