If this code includes a generic do/undo/redo algorithm for actions, it
would be interesting.  If not, I would suggest that someone do that. 
I think I may code up a tag interface that will automatically plug in
a do/undo/redo mini-framework for actions or other similar code.

On 7/22/05, Kent Boogaart <[EMAIL PROTECTED]> wrote:
> Actually, it turned out to be a bit harder than that. *sigh*
> 
> Here's how I've solved my problem (basically):
> 
> 1. Implement a base action which overrides the cancelled() method
> 
> 2. In the override, check whether the request is cancelled. If so, look for
> a forward and clear the cancellation. Return the forward.
> 
> 3. Subclass my base action from any cancelable action and include a cancel
> forward in the config for that cancelable action.
> 
> If anyone wants code, I can post.
> 
> Cheers,
> Kent
> 
> -----Original Message-----
> From: Kent Boogaart [mailto:[EMAIL PROTECTED]
> Sent: Saturday, 23 July 2005 12:07 PM
> To: 'Struts Users Mailing List'
> Subject: RE: How to cancel a cancel
> 
> Thanks for the suggestions guys. I stared at this one a bit longer and this
> is what I came up with...I put this code in my action class:
> 
> @Override
> public ActionForward cancelled(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response)
> {
>         return mapping.findForward(FORWARD_CANCELLED);
> }
> 
> And my config file just defines the cancelled action with a forward back to
> page 2.
> 
> By default this method returns null, which resulted in my save dispatch
> method being called, which had the special code to handle cancelling.
> However, the cancel flag wasn't being cleared.
> 
> Now it does what I want it to do - submits back to form 2 and *clears the
> cancelled flag*. To be honest, I don't know why the cancel flag is being
> cleared now but it certainly is.
> 
> As a final note, I had already tried using a forward instead of a submit but
> that didn't work for me because form 3 had data in it that form 2 required
> in order to display.
> 
> Thanks,
> Kent
> 
> -----Original Message-----
> From: Michael Jouravlev [mailto:[EMAIL PROTECTED]
> Sent: Saturday, 23 July 2005 1:08 AM
> To: Struts Users Mailing List
> Subject: Re: How to cancel a cancel
> 
> On 7/22/05, Rick Reumann <[EMAIL PROTECTED]> wrote:
> > Kent Boogaart wrote the following on 7/22/2005 5:49 AM:
> > >
> > > My actions for pages 2 and 3 have code like this in them:
> > >
> > >     if (isCancelled(request)) {
> > >         return mapping.findForward(FORWARD_CANCELLED);
> > >     }
> > >
> > > My question is: is this the normal way to do it? If so, is there an easy
> /
> > > nice way to reset the cancel flag. I understand I could just remove a
> > > request parameter but I want to make sure I'm doing this the best way.
> >
> > I'm really not sure of the 'best' way and I'm probably not doing it the
> > 'standard' way, but since I like to manually call validate from my
> > Actions, I just treat 'cancel' like I would any other form submit. (The
> > only benefit to the html:cancel tag (I think:) is that it allows you to
> > submit the page without having validate() called.)
> >
> > Since I like dispatch actions, I just pass the dispatch parameter
> > "cancel" and then I process it how I want in the action in my "cancel"
> > dispatch method. Sometimes, when I know the user can only get to the
> > page from a certain flow it allows me to call my prep() method and prep
> > the reulting page with whatever it needs for display.
> 
> I second that approach. Instead that I use redirect instead of
> forward, so all request parameters including Cancel are cleared
> automatically.
> 
> It may make sense to build each page as a dialog. Or even to create a
> wizard out of three pages.
> 
> --
> Struts Dialogs
> http://struts.sourceforge.net/strutsdialogs
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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

Reply via email to