When your ATG Servlet Bean displays an open parameter, that open parameter may 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 will display 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 will therefore be used. Remember that the parameter would also have been 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 may also add or change parameters that are visible to displayed elements. This is done by calling setParameter()
. For example, the ATG Servlet Bean may 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, then this will shadow the original definition of the parameter. The original definition of the parameter will return after this method is finished executing.