Re: Example of what I mean by problem when Action chaining

Vic Cekvenich <[email protected]> Mon, 02 Jun 2003 20:53:46 -0400
Newsgroups gmane.comp.java.mvc.devel
Organization baseBeans Engineering
Message-ID <[email protected]>
I am able to reproduce your issue using your code. I was not aware that 
this was an issue.
Excellent and concise example you posted.
What is your proposed solution?
.V

Rick Reumann wrote:

>I'll try to be brief as possible here. I put up a war file at
>http://www.reumann.net/reumann/struts/actionProblem.html that you can
>download and place in your webapps directory and see an example of how
>there are problems to consider when you forward from one Action to another
>(Action chaining this is called- lot about it on the Struts list).
>
>The idea that you can build navigation without concern about your underlying
>FormBeans only 'definitely' holds true when you are not forwarding to another
>Action. When you forward to another Action there are things to consider. I
>started the "My Headache" thread because of a situation that came when
>forwarding from one Action to another Action and I mentioned that if you
>could avoid this you are better off. 
>
>If you run the action_problem app at the link above you'll see just one
>very small example- not the exact example I ran into but something
>similar. If you don't feel like looking at the war here is a brief summary
>of the situation:
>
>Two form beans:
>
>BookBean
> private String title;
> private String description;
> private String bookNote;
> 
>ChapterBean
> private String title;
> private String description;
> private String content;
>
>
>Two Dispatch Actions
>    BookAction
>    ChapterAction
>
>1) On bookForm.jsp to fill out title, description, bookNote and submit
>will save. Form submits to BookAction
>
>2) BookAction has dispatch "save" and does the save, but now you want the
>user to fill out the ChapterBean and save that you so you have the
>BookAction foward to the ChapterAction with dispatch "edit"
>
>3) Now you are on the editChapter.jsp but NOTICE the title and description
>properties - they are filled in with the Book title and Book description!
>This makes sense though since the Request object is propogated along from
>one Action to the next when your forward to another Action (and
>ChapterBean has a title and description property as well).
>
>
>So the point I'm just trying to make is there are things to watch out for
>when Action chaining. Most agree that Action chaining serves it's purpose
>when you have one large FormBean that you need populated over several
>pages (ie- imagine online Tax Form preperations). However, in most
>circumstances it seems best to avoid forwarding one Action to another
>Action.
>
>
>My "headache' example was much more complex than the above example but it
>basically was a result of forwarding from one Action to another Action. (
>I had a nice nested beans detail display page and a link to "add a Task"
>from that page. When you clicked on the link to "add Task" you go through
>"taskAction" and when finished after Save you'd forward to the
>"detailAction" to bring you back to the detail page. Well when that
>occured Request properties that were on the taskForm.jsp were setting
>properties of other beans on the detail page since they had similar
>names).
> 
> 
>
>  
>

-- 
Vic Cekvenich,
Struts Instructor,
1-800-917-JAVA

Advanced <a href ="baseBeans.com">Struts Training</a> and project recovery in North East.
Open Source <a href ="baseBeans.com">Content Management</a>  basicPortal sofware
Best practice<a href ="baseBeans.com">Struts Support</a> v.1.1 helper ScafflodingXPress