The output element defines a map entry in a ModelMap. Once the actors are executed, the output values are evaluated and added to the ModelMap based on the name attribute.

The output element contains the following:

Attribute/Element

Description

id

Required. This attribute defines the actor ID, and is used for actor ordering.

name

Defines the name of the map entry. The value of this attribute can be static, or a dynamic EL expression. For additional information on ActorContext variables, refer to the Working with Implicit Objects section.

value

Defines the value of the map entry. The value of this attribute can be static, or a dynamic EL expression. For additional information on ActorContext variables, refer to the Working with Implicit Objects section.

filter-id

Defines the bean filter that will be applied when the value object is filtered using the BeanFilterService. Note that the filter-id attribute on a bean filter property will override this filter-id attribute.

embed-for-mime-type

Identifies if the value of the object should be embedded within the server response. For example, if the object is a JSON string, and it should be embedded in the JSON response, set the embedded mime attribute to application/json. If the ResponseGenerator has been set to output as JSON, the string is added to the JSON response. If the EmbeddedMimeType does not match the response mime type, (for example, the response mime type is set to XML), the JSON response will be encoded as a string inside the XML response.

add-map-children

This attribute, when set to true, copies the key/value pairs of a map value into the ModelMap. The value must be a map. This attribute is often used to pass the values of a child ModelMap to a parent ModelMap in a nested actor call.

depends

This element defines actors that must be executed prior to the execution of the current actor. There can be multiple depends elements associated with an actor.

depends-if-present

This element defines actors that, if present, must be executed prior to the execution of the current actor. There can be multiple depends-if-present elements associated with an actor.

message

The output tag supports internationalized messages that are added to the ModelMap.

The following is an example of an output element:

<output name="globalInfo" value="${CSREnvironmentTools}"
    filter-id="globalTemplate"/>

The filter-id identifies the filter for the BeanFilterService to apply. Refer to the Bean Filtering section for further information.

The output tag supports localized message tags, which add internationalized messages to the ModelMap. By default, all messages are localized based upon the current user’s locale, however, the locale can be passed in using the message tag.

The message element contains the following:

Attribute/Element

Description

id

Required. This attribute defines the message ID.

locale-code

The locale that will be used to localize the message, for example, en_US. If not available, the system will use the ServletUtil.userLocale setting.

bundle

Identifies the resource bundle that contains the resource key.

key

The resource key identified by the resource bundle.

message-param

If message parameters are required during the resource lookup, you can use the attributes used by this element:

id – The ID of the message param.
value – The value to pass.

The following is an example of an output element with a message element. Messages are, by default, localized using the user’s locale, however, you can set the locale using the message tag:

<output id="error" name="error"
  <message id="PRODUCT_NOT_IN_CURRENT_CATALOG"
      bundle="atg.commerce.catalog.custom.UserResources
      key="PRODUCT_NOT_IN_CURRENT_CATALOG">
    <message-param id="arg0" value="${(productId != null) ?
        productId : param.productId"/ >
  </message>
</output>

The output from the example above would be:

{"error": {
"messageCode" : "PRODUCT_NOT_IN_CURRENT_CATALOG",
"localizedMessage" : "Product xprod2099 is not defined in the current catalog"
}}

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