Encapsulates a transaction.

<dsp:demaracateTransaction var-spec>



Defines an EL variable or scripting variable 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 three properties:

Usage Notes

The dsp:demarcateTransaction tag manages a transaction by starting it, checking it for errors, committing the transaction if no errors exist, and rolling back the transaction if errors occur. This tag creates a variable whose properties—success, exception, and commitException—indicate the status of the transaction.

Note: An error might occur if dsp:demarcateTransaction starts execution when another transaction is in progress.


The following example assumes the following conditions are true:

<dsp:importbean bean="\atg\samples\Student_01" var="student"/>
<dsp:importbean bean="\atg\samples\Algebra" />

<dsp:demarcateTransaction var="demarcateXA">
  <dsp:setvalue bean="Algebra.class.student" value="${student.name}"/>
  <dsp:setvalue bean="Algebra.class.grade" value="${student.grade}"/>

  <c:if test="${!demarcateXA.success}">
    The grade could not be processed. Here's why:
      <c:when value="${!empty demarcateXA.exception}"/>
        <c:out value="${demarcateXA.exception}"/>

     <c:when value="${!empty demarcateXA.commitException}"/>
       <c:out value="${demarcateXA.commitException}"/>

In this example, the transaction encapsulates the tasks required to save the grades provided to students in a class. The transaction ensures that student names and grades are added to Algebra.Student_01 at the same time. If the transaction fails, no name or grade is saved; instead, the appropriate message displays for the exception or commitException exceptions.

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