Rolls back the current transaction.
<dsp:rollbackTransaction var-spec
>
...
</dsp:rollbackTransaction>
Attributes
var-spec
An EL variable or scripting variable that is defined with one of these attributes:
Attribute | Description |
---|---|
| Names an EL variable. When you use |
| Names a scripting variable that scriptlets and expressions can access at runtime. |
The variable has two properties:
success
: A Boolean property, specifies the status of the rollback transaction operation. A call toisSuccess
obtains the property’s setting.exception
: Identifies theThrowable
exception object produced when a transaction does not rollback properly. A call togetException
returns the exception object.
Usage Notes
dsp:rollbackTransaction
causes the tasks associated with the current transaction to halt processing and return to their pre-transaction state. This tag tracks whether the rollback action is successful and when it is not, provides a Throwable
exception object. This tag creates an EL variable that can be referenced by later tags, and provides access to the referenced object’s success
and exception
properties.
Example
<dsp:rollbackTransaction var="rollbackXA"/> <c:choose> <c:when test="${rollbackXA.success}"> Your band uniform order was canceled. </c:when> <c:otherwise> Your band uniform order could not be canceled. Here's why: <c:out value="${rollbackXA.exception}"/> </c:otherwise </c:choose>
In this example, if a particular transaction is successfully rolled back, the user sees the message Your band uniform order was canceled
. If the transaction is not successfully rolled back, the user sees the second message string Your band uniform order was canceled. Here's why:
and the exception.