This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes cancel button with dispatchAction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "cancel button with dispatchAction" Watch "cancel button with dispatchAction" New topic
Author

cancel button with dispatchAction

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
In the apache site it says:
Cancel handlers - DispatchAction, LookupDispatchAction, and MappingDispatchAction - Now provide default cancel handler that can be overridden. It also also possible to specify the default handler name.

HOW???


I'm trying to have a cancel button on a form that works with dispatchAction.

sturts-config.xml:


When I 'plug' my button on the jsp page:



I get the error message:

HTTP Status 400 - Request[/GroupTravelerList] does not contain handler parameter named operation

type Status report

message Request[/GroupTravelerList] does not contain handler parameter named operation

description The request sent by the client was syntactically incorrect (Request[/GroupTravelerList] does not contain handler parameter named operation).
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The method to handle a cancel button is "cancelled". (see the javadoc). You need to overrride that method and include whatever logic you want executed when the cancel button is pressed.

It also appears that you may have to send some value in the "operation" parameter since that is the declared handler parameter. Adding an onclick event to the button might do the trick. Something like this:

onklick="this.form.action += '?operation=dummy';"


Merrill
Consultant, Sima Solutions
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
ok, I managed to invoke the cancelled as explained. I'm using this:



Q: I've tried to 'convert' this button into an image but couldn't figure it out how

thank you
 
GeeCON Prague 2014
 
subject: cancel button with dispatchAction