Marks the bounds of a transaction within a JSP.
Class Name |
|
|---|---|
Component |
|
Required Input Parameters
None
Optional Input Parameters
transAttribute
Specifies how to handle the current transaction and whether to create a transaction. Its value must be one of the following:
requiresNew(default): The current transaction, if any, is suspended then resumed at the end of the droplet. A transaction is created before calling theoutputopen parameter, then committed at the end of the servlet bean.notSupported: The current transaction, if any, is suspended, then resumed at the end of the servlet bean. Theoutputopen parameter is executed without any transaction context.supports: The current transaction, if any, is used. Otherwise, no transaction is used.required: The current transaction, if any, is used. If there is no current transaction, then one is created before calling theoutputopen parameter, then committed at the end of the servlet bean.mandatory: If no transaction is in place, theoutputopen parameter is not executed and theerrorOutputis executed instead with an error message. If a transaction is in place, this setting behaves the same assupports.never: If a transaction is in place, theoutputopen parameter is not executed and theerrorOutputis executed instead with an error message. If no transaction is in place, this setting behaves the same assupports.
Open Parameters
output
Executed in the transaction context defined by the transAttribute parameter; if an earlier transaction error occurs, the servlet bean does not execute this parameter.
errorOutput
Executed if a transaction error occurs before or after the output open parameter. Within the open parameter, the error is communicated through the following parameters:
errorMessage: a text message indicating the errorerrorStackTrace: the full stack trace of the error
successOutput
Executed after the output parameter if the commit or rollback operation completes successfully.
Usage Notes
TransactionDroplet can be used to enclose an area of a page within its own transaction context behavior. Several transactional behaviors are available—the same set that are available for Enterprise JavaBeans.
The open parameter output is rendered within the context of the specified transactional behavior. If a transaction error occurs before the servlet bean can execute the output parameter, then output is not rendered.
If any transaction error occurs, the errorOutput open parameter is rendered; otherwise the successOutput open parameter is rendered after execution of the output open parameter.
Example
The following example shows execution of a demarcated portion of a page in its own transaction, as specified by the requiresNew directive.
<dsp:droplet name="/atg/dynamo/transaction/droplet/Transaction"> <dsp:param name="transAttribute" value="requiresNew"/> <dsp:oparam name="output"> ... portion of page executed in demarcated area ... </dsp:oparam> </dsp:droplet>

