I had the same problem - after reviewing the source code for DynaActionForm I realized 
that the underlying ArrayList is not 'automatically' instantiated by the 
DynaActionForm.  In other words, when the controller is trying to call 
DynaActionForm.set("myField[0]") because it sees a request parameter called 
'myField[0]', there is no ArrayList there yet to match the "myField" property.  My 
solution was to subclass DynaActionForm and just override the reset() method in order 
to instantiate the ArrayList.  (since reset() is called before any setters).  I think 
I also did this using an array of BasicDynaBeans, and again had to initialize the 
array in reset().  
 
Of course you don't have to do this when simply displaying the data, because you are 
populating the property with your ArrayList in Action.perform()/execute() before the 
DynaActionForm.get() methods are ever called.  
 
Is there a better solution out there?  I don't like having to write a subclass just to 
instantiate the ArrayList.
 
This is another example of where knowing the exact sequence of Struts events is 
crucial.  Has anyone ever written up a detailed step-by-step of what the controller 
does when a request comes in?  I've written a brief one for our company's developers - 
shall I post it?
 
Roman Fail
Sr. Web Application Developer
POS Portal, Inc.
 

        -----Original Message----- 
        From: Rick Reumann [mailto:[EMAIL PROTECTED]] 
        Sent: Tue 7/16/2002 1:33 PM 
        To: Struts List 
        Cc: 
        Subject: getting nested tags to work with DynaActionForm???
        
        

        I had an ArrayList property set in my DynaActionForm and it worked
        fine with the nested tag in displaying the information from the beans
        in the ArrayList of this DynaActionForm. The problem however came when
        I when I hit submit with the updated information. I kept getting
        BeanUtils.populate errors with no index value set for 'field.xxxx[0]'.
        Sorry can't cite the exact error since I now went to using a typical
        ActionForm and the nested tag page submits fine.
        
        Is there something special I need to do in order to get
        DynamicActionForms to work with Nested tags?
        
        Thanks,
        
        --
        
        Rick
        mailto:[EMAIL PROTECTED]
        
        



Reply via email to