HTML: Cancel tag to generate a Cancel button. When you click this button, Action servlet bypasses the validate () method of the corresponding form bean and gives the control to the corresponding action. In this action, you can use the action. iscancelled (httpservletrequest) method to determine whether the request has been canceled. If true is returned, the action is canceled. Otherwise, the action is not canceled.
Note that if you modify the property attribute value of the HTML: Cancel tag, the cancel detection mechanism provided by struts becomes invalid. You must provide a similar mechanism.
The following is the configuration file of the action that can be canceled. Note that the <set-Property = "cancellable" value = "true"/> line throws Org. apache. struts. action. invalidcancelexception exception. This is the only backward incompatible area I found during the completion of this Guide.
<Action Path = "/cancel"
Type = "org. Solo. Struts. Action. cancelaction" name = "cancelform"
Scope = "request">
<Set-Property = "cancellable" value = "true"/>
<Forward name = "success" Path = "/cancel. jsp"/>
</Action>
The code for the HTML: Cancel tag is as follows:
<HTML: Cancel> cancel The code in the corresponding action is as follows:
If (iscancelled (request )){
// What to do when action is canceled is written here
Return Mapping. findforward ("cancel ");
} Else {
// What to do when action is not canceled is written here
Return Mapping. findforward ("success ");
}
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/AWUSOFT/archive/2008/05/16/2452874.aspx