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.

Attributes

TagVariable:varorid(Required)

You must define an EL variable or scripting variable:

Attribute

Description

var

Names an EL variable. When you use var , you can set the scope attribute to page, request, session, and application, to specify the variable’s accessibility to other resources.

id

Names a scripting variable, which scriptlets and expressions can access at runtime.

VariableScope:scope

The scope attribute determines what resources can access the named EL variable. Options include: page, request, session, or application. Omitting this attribute causes the default, page, to be used.

Properties

success

The success property specifies the status of the rollback transaction operation. A call to isSuccess returns either true.

exception

The exception property identifies the Throwable exception object produced when a transaction fails to roll back properly. A call to getException returns the exception object.

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.

 
loading table of contents...