Triggers execution of all tasks encapsulated by the current transaction.
<dsp:commitTransaction var-spec
>
...
</dsp:commitTransaction>
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 whether the commit operation is successful. A call toisSuccess
obtains the property’s setting.exception
: Identifies theThrowable
exception object produced when the commit operation fails. A call togetException
returns the exception object.
Example
<dsp:commitTransaction var="CommitXA"/> <c:choose> <c:when test="${CommitXA.success}"> The transaction committed successfully<br/> </c:when> <c:otherwise> Transaction failed for the following reason:<br/> <c:out value="${CommitXA.exception}"/> </c:otherwise> </c:choose>
The dsp:commitTransaction
tag causes the transaction to commit. If the commit operation succeeds, the user sees the message The transaction committed successfully
. If the transaction fails to commit, the user sees the message Transaction failed for the following reason:
and the exception string.