The droplet element provides meta-data for ATG servlet beans. The DropletActor executes ATG servlet beans and adds object values to the ModelMap based on the meta-data.

The droplet element contains the following:

Attribute/Element

Description

name

This is the Nucleus path of the ATG servlet bean.

var

Exposes the current frame of the Dynamo param stack as an attribute.

id

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

oparam

Droplets may have one-to-many oparams.

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

input

This element defines each actor’s input. Actors can have multiple input elements.

output

This element defines each actor’s output. output elements create a map entry in a ModelMap. Actors can have multiple output elements.

DropletActors can be nested with all types of actors using the oparam element.

The Oparam Element

The oparam element can be used within the droplet element to identify names of droplet oparams. This element contains the following:

Attribute/Element

Description

name

The name of the oparam.

actors

The oparam element can have one or more actors that include output or set-var elements.

The following is an example of how to access droplet properties:

<component id="orderLookupBean" name="/atg/commerce/order/OrderLookup"
    component-var="orderLookupBean" />
  <droplet id="switch" name="/atg/dynamo/droplet/Switch">
    <input name="value" value="${orderLookupBean.enableSecurity}" />
    <oparam name="true">
      <droplet id="orderLookup" name="/atg/commerce/order/OrderLookup"
          var="orderLookupParamStack">
...
      </droplet>
  </droplet>

The following is an example of a droplet and oparam element:

<!atg.service.actor.DropletActor will process this tag.->
<droplet id="productLookupDroplet" name="/atg/commerce/catalog/ProductLookup"
    var="productLookupDropletParamStack">
  <input name="productId" value="${param.productId}"/>
  <oparam name="output">
    <output name="product" value="${productLookupDropletParamStack.element}"
        filter-id="orderSummary"/>
  </oparam>
  <oparam name="empty">
    <!-handle case where product is not found -->
  </oparam>
</droplet>
Example: Nesting Droplet Elements

It is possible to nest droplet elements. For example:

<actor-chain>
  <droplet path="/atg/store/droplet/StoreLookupDroplet" var="storeLookup">
    <oparam name="output">
      <droplet path="/atg/store/droplet/StoreSiteFilterDroplet"
          var="storeSiteFilter">
        <!-read 'items' from StoreLookupDroplet -->
        <input name="collection" value="${storeLookup.items}"/>
        <!-output array of stores for the current site -->
        <oparam name="output">
          <output name="stores" value="${storeSiteFilter.filteredCollections}"/>
        </oparam>
      </droplet>
    </oparam>
  </droplet>
</actor-chain>

Because each actor-chain has its own ActorContext and ModelMap, you can use the input and output of nested actors to pass inputs into nested ActorContext and return outputs from nested ModelMaps. In the following example, the add-map-children attribute copies the properties in the nested ModelMap to the outer ModelMap:

  </actor-chain><actor-chain id="addItemToOrder-success">
  <actor id="order" name="/atg/commerce/ShoppingCartActor"
      chain=id="detailed" return-model-var="model">
    <output id="model" add-map-children="true" value="${model}"/>
  </actor>
</actor-chain>

Note that you should make your actors accessible from the client, using the request parameter, or the nested actor, using the variable. Clients pass actors as param, for example param.orderId. Nested actors pass their variables as ActorContext variables. You must configure your input to look for both param and ActorContex variables. For example:

<input name="orderId" value="${orderId == null ? param.orderId : orderId}"/>
Example: Evaluating Servlet Beans

When working in a JSP page, you can identify a bean parameter. For example:

<dsp:importbean
    bean="/atg/svc/agent/ui/formhandlers/CustomerSearchTreeQueryFormHandler"
    scope="request" />
<dsp:droplet name="/atg/droplet/Switch">
  <param name="value" bean="CustomerSearchTreeQueryFormHandler.pagesAvailable"/>
  <oparam name="0">
    <!-perform an action -->
  </oparam>
</dsp:droplet>

There is no bean attribute available for DropletActors. Instead, you can retrieve servlet beans using the $nucleus syntax. For example:

<droplet name="/atg/droplet/Switch">
  <input name="value" value="${nucleus[/atg/svc/agent/ui/formhandlers/
      CustomerSearchTreeQueryFormHandler].pagesAvailable}"/>
  <oparam name="0">
    <!-perform an action -->
  </oparam>
</dsp:droplet>
Example: Setting a Variable Within an oparam

The set-var element sets a variable as an attribute. For additional information on this element, refer to The Set Variable Element section. This example shows how to set a set a variable named sites within an oparam element:

<droplet id="sharingSites"
    name="/atg/dynamo/droplet/multisite/SharingSitesDroplet"
    var="sharingSitesParamStack">
  <oparam name="output">
    <set-var name="sites" value="${sharingSitesParamStack.sites}"/>
  </oparam>
</droplet>

You could then use the variable:

<droplet id="productLookup" name="/atg/commerce/catalog/ProductLookup"
    var="productLookupParamStack">
  <input name="sites" value="${sites}"/>
  <oparam name="output">
  </oparam>
</droplet>

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