I wouldn't call this Action Chaining. Action Chaining is taking two "model actions", like Copy and Delete, and using to invoke three different business use cases: Copy, Delete, and Move (Copy->Delete). Wanting to do this sort of thing is a red flag that the underlying business facade is underdeveloped. It should be just as easy to have an actual Move action that does Copy and Delete and then transfer to the View. Forwarding from a "model" action to another "model" action is the Struts practice equivalent of a GOTO.
Here, it looks like the TraceList action is acting as a "view action" for the TraceList.jsp. It's not a business transaction that is changing the state of the application, it's a view action that is exposing the state of the application. As long as the general idea, then this is something that I would also do myself. As mentioned on the ticket, a reasonable change to the API would be to make populating the ActionForm a lifecycle event, like Validate. Considering this idea is on the Roadmap for the Struts Core 1.5.x series. * http://struts.apache.org/milestones.html Speaking to reset, a bad practice, that unfortunately some of our own examples encouraged, is using reset to clear everything. You do need to reset checkboxs in session scope, but, in other cases, the practical effect is neglible (unless you are chaining business actions). I started a Struts practices presentation, but managed to leave "Prefer a fine-grained reset" off the list :(. The presentation would be a good candidate for a set of "Struts Practices" wiki pages, if someone were interested. * http://tinyurl.com/dneyb -Ted. On 10/15/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I resolved this in my applications by forwarding to a new action mapping in > stead of directly to the jsp. > My View helper is a plain struts action. > > So, in stead of directing to tracelist.jsp after saving users input, I > forward to tracelist.do > > <action path="/trace/tracesave" > type="myapp.trace.TraceSaveAction" > name="traceForm" > scope="request" > input="/trace/tracedetail.do"> > <forward name="success" path="/trace/tracelist.do"/> > </action> > > and > > <action path="/trace/tracelist" > type="myapp.trace.TraceListAction" > name="tracelistForm" > scope="session"> > <forward name="success" path="/trace/tracelist.jsp"/> > </action> > > The advantage of this is that the save action does not have to know what > extra resources are needed for the view page, > and that no new mechanisms are needed to have a View helper in struts. > > The disadvantage is that in struts community this is regarded as a bad > practice (action chaining). > My defence to this opinion is that I do not do this to implement business > processess by chaining actions, but that I just need a front controller to > prepopulate resources. > > I've opened enhancement request 16107 to support this mechanism. > http://issues.apache.org/bugzilla/show_bug.cgi?id=16107 > > Jan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
