You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Roman Fail <rf...@posportal.com> on 2002/07/18 00:14:31 UTC
Struts event sequence (WAS: getting nested tags to work with DynaActionForm???)
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:DCancro@bridgespan.com]
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:rfail@posportal.com]
> 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:maillist@reumann.net]
> 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:maillist@reumann.net
>
>
>
>
Re: Struts event sequence (WAS: getting nested tags to work with
DynaActionForm???)
Posted by Eddie Bush <ed...@vestus.adabbs.com>.
Hey - I wish I'd had that when I started with Struts!
I don't personally agree with your philosophy on setting autoCommit to
true, but I liked the page other than that :-) <click>Add
Bookmark</click> I just feel having autoCommits off is a good thing.
That way you have explicit control over the transaction. If, however,
you typically don't need it, I can understand setting autoCommit(true).
Maybe I'm just too anal ;-)
Thanks :-)
Eddie
Roman Fail wrote:
>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.
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>