Hi,
There's been loads of discussion about how to implement this action 
chaining..
Last night I cooked up yet another possible way to do it..
The chainToPage class implementation by Keith Bacon posted earlier 
seemed like a nice way to do it at first.. But what I'm looking for is
a more generic way to do this without the action classes actually even
realizing what's happening..
I have a semi-working implementation of the following:

- On the page to which we want to chain to another page we add the
   following tag on the jsp-page (or something similar).
   <app:returnStamp to="/thisAction" from="/theOtherAction" />
- the returnStamp tag saves request parameters and attributes into
   an object (let's call it a stampObject) that is stored to the
   session along with the to and from information
- all action - classes are extended from some baseaction (as suggested
   by Ted Husted) and this baseaction checks the session to see if there
   is a stampObject in the session with a from field for this action.
- if there is one, a new ActionForward object is constructed from
   the to - field and this page forwards to it after the processing is
   done
- when we return to /thisAction we extract the attributes from
   the stampObject and store them as request attributes and remove
   the stampObject from the session.

Now to achieve the transparency we should define a few helper methods
to our baseaction - class.
- getParabute( HttpServletRequest request, String name )
   * perform calls this to acquire both request parameters and
     attributes because if we were forwarded from another action the
     needed parameters for this action are not stored in the request
     parameters but in the attributes. This method first tries to
     find the requested 'name' parameter from attributes and then from
     parameters

Possible quirks:
- If we never get back to the /thisAction - page we never remove the
   stampObject from the session. I'm not sure how much stuff we should
   store in the session.. This is actually one question that someone
   could answer: How much stuff should you save in the session and are
   there any reasons why _not_ to store long term data in the session ?
- If we have the following page structure:
   page A -> page B -> page C -> (back to) page A
   Now from page C we return to page A by using the method described
   above. But what if we have a page D that the user can get to from
   page B and the user goes there and later from page D the user
   goes back to page B and from there should be forwarded back to page D.
   But in the session we have another forward for this page
   (the original one. Going back to page A) and we return there and
   _not_ to page D.
   * The only solution to this problem I have come up so far is to
     add the <app:returnStamp> - tag to _all_ pages that
     we can get to from page C

Hopefully my explanation was clear enough..
Now your task, should you choose to accept it, is to shoot down this idea :)

/tuomo


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to