I am getting same error when i submit the form having newly added row.
Error is :

javax.servlet.ServletException: BeanUtils.populate
        org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
        
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:804)
        
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
        org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
        org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

java.lang.ArrayIndexOutOfBoundsException
        java.lang.reflect.Array.get(Native Method)
        
org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:437)
        
org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:340)
        
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:684)
        
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
        
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:884)
        
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
        org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
        org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
        
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:804)
        
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
        org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
        org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:709)



        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Here is the reset() method:

   public void reset(ActionMapping mapping,HttpServletRequest request) {
                System.out.println("reset called");
                int count=0;    
                if (null!=this.customer) {
                        String value = 
request.getParameter("customer[0].firstName");
                        System.out.println("value :" + value);                  
                if (value != null) {
                        while ((value = request.getParameter("customer[" + 
count +
"].firstName")) != null) {
                             System.out.println("value :" + value);
                             count++;
                        }
                }       
                
                Customer[] customers = new Customer[count];
                System.out.println("Customer[] size :"+customers.length);
                ListTextActionForm f = new ListTextActionForm();
                f.setCustomer(customers);
                
        } else {
                        System.out.println("Customer[] is null");
                }               
   }

No error arise  if no new row is added and code work fine.

Any solution to this issue
atta-ur rehman: Can i have ur msn/hotmail id for efficient conversation.

Thanks

Reply via email to