Starts a transaction and tracks whether the transaction is created successfully.
<dsp:beginTransaction var-spec>
...
</dsp:beginTransaction>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 start transaction operation. A call toisSuccessobtains the property’s setting.exception: Identifies theThrowableexception object produced when a transaction does not start properly. A call togetExceptionreturns the exception object.
Example
<dsp:beginTransaction var="beginXA"/>
<c:choose>
<c:when test="${beginXA.success}">
Transaction started <br/>
</c:when>
<c:otherwise>
Transaction failed due to this exception:
<c:out value="${beginXA.exception}"/>
</c:otherwise>
</c:choose>In this example, the tag causes a transaction to begin. If the call is successful, the user sees the message Transaction started. If the call fails, the user sees the message Transaction failed due to this exception and the exception string.

