commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandeep Mittal" <sandeep.mit...@openwave.com>
Subject NEED HELP with struts form bean - BeanUtils Populate
Date Mon, 05 May 2003 22:53:59 GMT
> Hi All,
> 
> After spending 3 days in following problem, I can't figure out and
> desperately needs help. I will appreciate any help/direction.
> 
> 
> I have a property in struts form bean. This property is an array of a
> class. for e.g.
> 
>     private NAIObject[] _naiSearchResults;
> 
>     public  NAIObject[] getNaiSearchResults () {
>         return _naiSearchResults;
>     }
>     public  void setNaiSearchResults( NAIObject[] naiSearchResults ) {
>         _naiSearchResults =  naiSearchResults ;
>     }
>     public  NAIObject[] getNaiObject () {
>         return _naiSearchResults;
>     }
> 
> 
> My JSP page looks like :
>                 <logic:present name="createDeviceForm" 
>                                property="naiSearchResults">
> 
>                     <logic:iterate id="naiObject" name="createDeviceForm" 
>                                    property="naiSearchResults">
>  
>                          <html:checkbox name="naiObject" property="nai"
> indexed="true"/>
> 
>                     </logic:iterate>
>                 </logic:present> 
> 
> This produces html code :
>                 <input type="checkbox" name="naiObject[0].nai" value="on">
> 
> 
> Problem is that when struts try to auto populate the form bean, it
> complains about :
> 
> java.lang.reflect.InvocationTargetException:
> java.lang.NullPointerException
> 	at
> com.openwave.opm.ui.customercare.createdevice.CreateDeviceForm.getNaiObjec
> t(CreateDeviceForm.java:757)
> 	at java.lang.reflect.Method.invoke(Native Method)
> 	at
> org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtil
> s.java:440)
> 	at
> org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtil
> s.java:375)
> 	at
> org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils
> .java:709)
> 	at
> org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:
> 741)
> 	at
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:560)
> 	at
> org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:504)
> 	at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:966)
> 	at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor
> .java:795)
> 
> I just can't figure out the problem with my code. Please help. Do you have
> any form bean which defines array of class? Thanks a lot.
> 
> Best Regards,
> Sandeep
> 


Mime
View raw message