Each servlet bean has a predefined set of parameters that control the servlet bean’s behavior. Servlet beans have three types of parameters:

Input

Input parameters are passed into the servlet bean. The previous example supplies the input parameter array to identify the type of data to process—in this case, the component array property Student_01.subjects.

Output

Output parameters are set by the servlet bean. In the previous example, element is an output parameter that contains the value of the current array element. As the ForEach bean cycles through the subjects array, element is successively set to each element value. Thus, if there are five elements in the array, on each loop iteration element is set to five different values.

Open

Open parameters are marked by dsp:oparam tags, and specify code to execute at different stages of servlet processing. The previous example uses three ForEach servlet bean open parameters:

The HTML that is rendered by the example’s open parameters might look like this:

<p>The student is registered for these courses:
<ul>
<li>Linguistics</li>
<li>Biology</li>
<li>Victorian Poetry</li>
<li>Latin</li>
<li>Philosophy</li>
</ul>

While output parameters are set by the servlet bean, they are rendered on the page only if they are referenced in an open parameter. In this example, the output parameter element is set by the servlet bean, but the dsp:valueof tag in the open parameter is used to display the element values.

Note: Certain HTML tags cannot overlap different open parameters. For example, the open and close tags of dsp:form<dsp:form> and </dsp:form>—must both be embedded in the same open parameter. This constraint applies to the following DSP tags:

<dsp:a href="...>
<dsp:form ...>
<dsp:textarea ...>
<dsp:select>

 
loading table of contents...