Establishes a site context for this servlet bean’s output.

Class Name

atg.droplet.multisite.SiteContextDroplet

Component

/atg/dynamo/droplet/multisite/SiteContextDroplet

Input Parameters

siteId

The site ID of the requested site context, ignored if emptySite is set to true. This parameter must not be null if the emptySite parameter is set to false.

emptySite

If set to true, creates an empty site context. The default setting is false.

Output Parameters

output

Rendered once for the specified site context.

error

Rendered if the requested site context cannot be found or an empty site context cannot be created.

errorMessage

If an error occurs, contains the error message.

siteContext

Set to the siteContext object of the specified site ID.

Usage Notes

The SiteContextDroplet changes the site context from the supplied site ID and its output parameter acts as a wrapper for the new site context. Before the output parameter executes, the SiteContextManager uses the site ID to push a new SiteContext object onto the SiteContext stack and establish it as the new site context. This site context remains in effect until SiteContextDroplet exits; the SiteContextManager then pops the site context off the stack and restores the previous site context to the page.

You can use SiteContextDroplet to set an empty site context by setting emptySite to true. An empty site context removes all site context information from the page for the duration of output parameter execution. While the site context is empty, the page has access to the data of all repository items, regardless of how their siteIds property is set.

If desired, you can make an entire page ignore site-specific settings in repository items by wrapping it entirely inside SiteContextDroplet’s output parameter and setting emptySite to true. In this way, you can ensure that behavior of a given page in a multisite application conforms to its behavior in a non-multisite application. For example, given multiple store sites, you might want to set an empty context in order to promote certain product items across all sites.

Example

The following example changes the site context:

<dsp:page>
<%-- change site context to the supplied site parameter --%>

<dsp:getvalueof var="newSite" param="site"/>

<dsp:droplet name="/atg/dynamo/droplet/multisite/SiteContextDroplet">
  <dsp:param name="siteId" value="${newSite}" />
  <dsp:oparam name="output">
    You might also be interested in this:
       <dsp:valueof param="cross-sell.description" />\! <BR/>
  </dsp:oparam>
  <dsp:oparam name="error">
     The following error occured:
<dsp:valueof param="errorMessage"/>
  </dsp:oparam>
</dsp:droplet>

</dsp:page>