Your main problem is that simply naming the variable the same as the
form Bean name isn't going to create the correct instantiation of the
form.  You're basically creating a "vanilla" uninitialized
DynaValidatorForm and then trying to set it's properties, but it doesn't
have any.

The "official" way to instantiate a DynaForm bean in struts is to have
it be the input form for an action, which will cause it to be
automatically instantiated.  Sometimes this can mean chaining through an
extra action just to instantiate a new form bean, especially in the
cases where you are processing one form, and then prepopulating another.

James

> -----Original Message-----
> From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 16, 2003 7:34 PM
> To: [EMAIL PROTECTED]
> Subject: Problem with using DynaValidatorForm, is it possible 
> to do it??
> 
> 
> Hi,
> I am trying to do the following and i get null pointer exception,
> DynaValidatorForm   PL1820UpdateForm = new
> DynaValidatorForm();
> PL1820UpdateForm.set("input1",  "This is test");
> 
> And my form definiation in struts-config is
> 
> <form-bean name="PL1820UpdateForm" dynamic="true" 
> type="org.apache.struts.validator.DynaValidatorForm">
> <form-property name="input1" type="java.lang.String"
> />
> </form-bean>
> 
> The error i get it following
> java.lang.NullPointerException
> [1/16/03 19:30:24:908 EST] 311dffa9 SystemErr     R 
> at
> org.apache.struts.action.DynaActionForm.getDynaProperty(DynaAc
> tionForm.java:551)
> [1/16/03 19:30:24:908 EST] 311dffa9 SystemErr     R 
> at
> org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:365)
> [1/16/03 19:30:24:908 EST] 311dffa9 SystemErr     R 
> at
> com.pfizer.maps.action.sop.PL1820DispatchAction.getData(PL1820
> DispatchAction.java:197)
> [1/16/03 19:30:24:908 EST] 311dffa9 SystemErr     R 
> at
> com.pfizer.maps.action.sop.PL1820DispatchAction.change(PL1820D
> ispatchAction.java:145)
> 
> Need help
> 
> 
> 
> 
> 
> 
> =====
> A$HI$H
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now. 
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to