Requires roll back of the current transaction.




An EL variable or scripting variable that is defined with one of these attributes:




Names an EL variable. When you use var, you can set its scope attribute to page, request, session, or application. The default scope is page. For more information, see EL Variable Scopes.


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

The variable has two properties:

Usage Notes

dsp:setTransactionRollbackOnly specifies that when the current transaction ends, it must fail and roll back. This tag does not cause a transaction to roll back now, but rather instructs the transaction to end in a rollback action when it is prompted to end.

The tag’s ability to set the current transaction to setTransactionRollbackOnly is saved to the named EL variable. You can see tag’s success or failure through the success property and exceptions through the exception property.


<dsp:beginTransaction var="beginAdvancedAlgebra"/>
<dsp:tomap bean="/atg/samples/Student_01" var="student"/>

   <c:when test="${!student.passedBeginningAlgebra}"/>
      You can't take advanced because you did not pass Beginning Algebra.
         <dsp:setTransactionRollbackOnly var="rollbackOnlyXA"/>
            <c:if test="${rollbackOnlyXA.exception = !empty}">
               The system is having trouble processing this information
               for the following reason:
               <c:out value="${rollbackOnlyXA.exception}"/>
      You may enroll in Advanced Algebra.
<dsp:commitTransaction var="commitAdvancedAlgebra"/>

In this example, a transaction is used to manage the enrollment process for Advanced Algebra. After the transaction is created, the student’s record is checked for successful completion of the beginning level Algebra class. The beginning level class is a prerequisite for enrolling in the advanced class, so the transactions are set to roll back. If an error occurs and dsp:setTransactionRollbackOnly does not set the transaction to end in a future rollback action, the exception is displayed. Otherwise, the dsp:commitTransaction tag tries to end the transaction.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices