When your ATG servlet bean displays an open parameter, that open parameter can itself contain dynamic elements such as dsp:valueof and dsp:droplet tags. As always, when a dynamic element contained in an open parameter is displayed, it draws from the list of visible parameters to display its own dynamic elements.

The parameters visible to those elements are the same as the parameters visible to the dsp:droplet tag. For example:

<%@ taglib uri="/dspTaglib" prefix="dsp" %>
<dsp:page>

<html>
<head>
  <title>Store Test</title>
</head>

<body bgcolor="#ffffff">
  <h1>Store Test</h1>

<dsp:droplet name="/test/DSBTest2">
  <dsp:param name="goods" value="Lingerie"/>
  <dsp:oparam name="storename">
    <h1>Joe's <dsp:valueof param="goods"></dsp:valueof></h1>
  </dsp:oparam>
</dsp:droplet>

</body>
</html>


</dsp:page>

In this example, the storename parameter includes a dsp:valueof element that displays the value of goods. The DSBTest2 object can display this by calling serviceParameter. When it is displayed, the dsp:valueof tag looks through the visible parameters for a parameter called goods. Because that parameter is defined in the dsp:droplet call, that parameter is visible to the dsp:valueof tag and is therefore used. Remember that the parameter would be visible if it were defined as a top-level parameter, or if this page were itself included by some other dsp:droplet tag that defined the goods parameter.

The ATG servlet bean can also add or change parameters that are visible to displayed elements. This is done by calling setParameter(). For example, the ATG servlet bean can set the goods parameter in code:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import atg.servlet.*;

public class DSBTest3 extends DynamoServlet {
  public DSBTest3 () {}

public void service (DynamoHttpServletRequest request,
                     DynamoHttpServletResponse response)
     throws ServletException, IOException
{
  request.setParameter ("goods", "Golf Balls");
  request.serviceParameter ("storename", request, response);
}
}

The setParameter call brings the goods parameter with value Golf Balls into the list of parameters that are visible to displayed objects. If a goods parameter is already visible, this shadows the original definition of the parameter. The original definition of the parameter returns after this method finishes execution.


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