ClassName |
|
|---|---|
Component |
|
The TransactionDroplet servlet bean can be used to enclose an area of a page within its own transaction context behavior. Several transactional behaviors are available—the same set available for Enterprise JavaBeans. The output open parameter is rendered within the context of the specified transactional behavior. If any transaction-related error occurs, the errorOutput open parameter is rendered after the output open parameter is rendered; otherwise the successOutput open parameter is rendered after the output open parameter is rendered. If a transaction-related error occurs before the output open parameter is rendered, then the output open parameter is not rendered but the errorOutput open parameter is.
Input Parameter
transAttribute
The value of this parameter describes how the current transaction should be handled and whether any new transaction should be created. The default value is requiresNew. Its value, if specified, must be one of the following:
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.requiresNew: The current transaction, if any, is suspended then resumed at the end of the droplet. A new transaction 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
This is the open parameter that is executed in the transaction context defined by the transAttribute parameter.
errorOutput
This is an optional open parameter that is executed if a transaction-related error occurs either 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
This is an optional open parameter that to execute if the commit or rollback operation completes successfully.
Example
This example illustrates executing 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>

