Java Reference
In-Depth Information
Table 8.6
Parameter tag attributes
(continued)
This value is used to append to the tag's resulting body content. The
append
value will not be appended if the tag's resulting body content is empty.
close
(optional)
This attribute value defines whether the first nested content-producing tag will
have its
prepend
value removed.
removeFirst-
Prepend
(optional)
All of the attributes in table 8.6 are available in the tags listed in table 8.7.
Table 8.7
Parameter tags
<isParameterPresent>
Determines whether a parameter object is present
<isNotParameterPresent>
Determines whether the parameter does not exist
Listing 8.6 shows how to use a parameter tag in a select statement.
Listing 8.6
Parameter tag example
…
<select id="getProducts" resultClass="Product">
SELECT * FROM Products
<isParameterPresent prepend="WHERE ">
<isNotEmpty property="productType">
productType=#productType#
</isNotEmpty>
</ isParameterPresent >
</select>
…
In this example, we create a simple select statement again, and this time we option-
ally create the
WHERE
for filtering the results based on the
productType
parameter.
8.2.5
The <iterate> tag
The
<iterate>
tag takes a property that is a
Collection
or array to produce repet-
itive portions of
SQL
from a set of values. The list is rendered by rendering the val-
ues of the list to a
SQL
fragment separated by the
conjunction
attribute's value.
The
open
attribute value is what is prefixed to the beginning of the rendered value
list. The
close
attribute is what is appended to the rendered value list. The tag
attributes are shown in table 8.8.
















