On Wed, February 15, 2006 2:46 pm, [EMAIL PROTECTED] said: > Is it, however, possible that you could design you application to where > all the mapped actions were "setup actions"? I guess not. Basically this > is a question of whether we can introduce a hierachy into the actions? Is > this a bad thing? Something that should already be handled?
I guess the question to ask is what are the kinds of Actions... I don't mean DispatchAction vs. Action vs. whateve else, but the *purpose* of the Action. I can only see: * Setup Action, called when any page is first displayed * Event Handler Action, called most usually in response to a form submission. There is really two sub-types to this, one where the resultant forward returns you to the same page, and one where it brings you to another page. When you go to another page, the question is, do you forward directly to a JSP (I'd bet most people do... I know I do that most often) or does it go to another Action, which is the setup Action for the next page? Some people may refer to that as "action chaining", but I don't think it is. If you always forward to another Action, instead of directly to JSPs, what your rally doing is creating almost a prerender phase to the next page. You also are giving yourself the opportunity to have more information, not to mention control, over what goes on. In that way, I suppose you *could* create an app that was nothing but setup actions... that would imply though that there are no events outside page transitions... sounds a lot like a wizard to me :) In other words, you have something like: Action A executes to set up page A... Page A is shown... For submitted to Action A1, forward to Action B... Action B executes to set up Page B... Page B is shown... ...and so on... Nothing unusual there, except that no Action would ever return a forward that points directly to a JSP, except a setup Action... Action A1 for instance would return a forward that points to Action B's mapping. Frank > > > > --- On Tue 02/14, Frank W. Zammetti < [EMAIL PROTECTED] > wrote: > From: Frank W. Zammetti [mailto: [EMAIL PROTECTED] > To: user@struts.apache.org > Date: Tue, 14 Feb 2006 18:59:11 -0500 > Subject: Re: Another struts design question > > Michael Jouravlev wrote:> On 2/14/06, Rick Reumann <[EMAIL PROTECTED]> > wrote:> >> In the action just look for some param like "fromPage" and > key off of>> that for your return. (Of course a drawback is you'll need to > remember>> to set this var on the pages that need it - of course there are > ways you>> could simplify that even, if really necessary).>> >> Using > session is much simpler ;-)>> This is one of those times I would agree > :)My suggestion would be to have a base Action in which you set a session > attribute to tell which page was server. Actually, you would store two, > the current and the previous.Here's my concern... let's say you have page > A and page B, from which you can go to page C. From page C you want to > return to page A or B as appropriate. You could do this a number of ways, > but what if you are using the common paradigm of a setup Action for a > screen, and then a collection of Actions which really can be though of as > event handlers for a given screen > (could be a DispatchAction just as well, that wouldn't change anything).If > you want to go back to page A from page C, and you got to page C by maybe > submitting a form, then the problem is that you got to page C via an event > handler in essence. But, when you return to page A, you really want the > setup Action to fire again. So, just recording the last request isn't > sufficient.If you have a base Action that sets that session attribute, > then you can have only your setup Actions extend that base class. Then, > when you want to return to the last page from any other page, you look up > that value and you now know which SETUP Action you need to call. More > precisely, you would look at the second value in session (think of it as a > stack) because every time a setup Action is called you really need to push > a value on the stack so that the second value on the stack is truly the > last page, not the current pages' setup Action.Does that make any sense to > anyone but me?? :)Frank> > ---------------------------------------------------------------------> To > unsubscribe, e-mail: [EMAIL PROTECTED]> For additional > commands, e-mail: [EMAIL PROTECTED]>>>>> > ---------------------------------------------------------------------To > unsubscribe, e-mail: [EMAIL PROTECTED] additional > commands, e-mail: [EMAIL PROTECTED] > > _______________________________________________ > Join Excite! - http://www.excite.com > The most personalized portal on the Web! > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]