This is the very basic outline of Struts events (with some helpful comments) that I 
worked up when I was using Struts 1.0, although most of it is still the same.  
Basically I've just expanded steps 3 & 4 of Dan's diagram a bit.  Chapter 5 of Chuck's 
book is much more detailed than this, and an excellent resource (Thanks, Chuck!).  In 
fact I think chapter 5 might be a bit overwhelming for a newbie, and reading the 
ever-changing Struts source code is not comfortable at first.  
 
I've found that this little outline has helped our new Struts developers a lot.  Craig 
suggested a nice UML sequence diagram for the docs, which would be great - but I'm not 
fluent in UML yet.  Here's my document - keep in mind it's been about a year since I 
wrote this, but I'd be happy to take suggestions on updating it:
 
http://www.posportal.com/StrutsOverview.html
 
Roman Fail
Sr. Web Application Developer
POS Portal, Inc.
 

        -----Original Message----- 
        From: Dan Cancro [mailto:[EMAIL PROTECTED]] 
        Sent: Tue 7/16/2002 5:00 PM 
        To: 'Struts Users Mailing List' 
        Cc: 
        Subject: RE: getting nested tags to work with DynaActionForm???
        
        

        I'd like to see what you've written. 
        
        Here's how I understand it so far:
        http://members.telocity.com/dcancro/images/eng/Struts_MVC.gif
        
        
        
        > -----Original Message-----
        > From: Roman Fail [mailto:[EMAIL PROTECTED]]
        > Sent: Tuesday, July 16, 2002 4:35 PM
        > To: Rick Reumann; Struts List
        > Subject: RE: getting nested tags to work with DynaActionForm???
        >
        >
        > 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