I was thinking very simplistically... from within execute() of ActionA:
ActionB a = new ActionB(); ActionForward af = a.execute(mapping, inForm, request, response);
I've done this in some limited circumstances. Then you can either use the ActionFoward returned, or just ignore it (which is almost certainly what you want to do anyway).
In some cases I'll set an attribute in request before calling on ActionB, and this attribute tells it to skip certain pieces of work. Although I've done this, I don't think I advocate it though because anything that directly ties two Actions together, even if losely, I don't think is a good idea in general.
One way I could see doing it would be do add a PrepView attribute to the action mapping that would be in the form "class.method". Basically, any time validation fails and your going to return to the input page, call that method, who's job it is to prep the page for viewing. There's of course details in there to be dealt with, but the basic idea might be good. That way, the choice would be the developers whether they want to have a new class to do this work, or just make it a method of an existing Action (I could see either being appropriate in some situations).
Frank
From: Joe Germuska <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Subject: RE: Pulling Punches Date: Tue, 22 Jun 2004 09:43:00 -0500
At 9:28 AM -0400 6/22/04, Frank Zammetti wrote:Interesting... I wonder if the answer would be different if you make the distinction between forwarding to another Action and just calling execute() of another Action. I think both have problems certainly, but just calling execute() seems a little less offensive to me because there is a greater degree of control over what is being done (i.e., no auto-population to worry about for instance).
Just calling execute() is pretty innocuous, but at that point, the question becomes "what's the correct way to get a handle on that action instance." In fact, one of Ted's ideas for a ViewController was simply to use the Action interface rather than making something new. I don't love that, because I think the semantics of what the ActionMapping and ActionForm would be aren't too clear.
The real objection is to invoking RequestProcessor.process(), which is ultimately what happens if you call RequestDispatcher.forward() or RequestDispatcher.include() (which, in turn, is ultimately what happens if you return an ActionForward which maps to a Struts Action or use a Struts action as the input forward for a form).
Joe
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll know I'm in the wrong place."
- Carlos Santana
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Make the most of your family vacation with tips from the MSN Family Travel Guide! http://dollar.msn.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]