Sun Java System Portal Server Mobile Access 7.1 Tag Library Reference

if

Description

The if tag tests the specified property and includes the tag body if the property evaluates to true.

Tag Body

JSP

Restrictions

If the name attribute is not specified then uses a parent bean tag to locate the bean on which to operate. The property specifies what to test. The value attribute specifies the string value to test the property; the id attribute specifies the bean object value to test the property. If neither value or id is specified then the test is true if the property value is non-null.

Attributes

This tag has the following attributes for which the Required value are “Yes” and “No”:

name

Name of the bean to use.

property

Name of the property to test.

value

String value of the property to test.

id

Bean object value of the property to test.

Properties

None.

Example(s)
<%-- test if the date time == 0 on parent bean --%>
<util:bean type="java.util.Date">
<util:if property="time" value="0">
... date.time == 0
</util:if>
</util:bean>

<%-- test if the date time == 0 on named bean --%>
<util:bean id="date" type="java.util.Date"/>
...
<util:if name="date" property="time" value="0">
... date.time == 0
</util:if>

<%-- test if bean property is non-null --%>
<util:bean type="Bean">
<util:if property="name">
... Bean.name != null
</util:if>
</util:bean>

<%-- test using two beans --%>
<util:bean id="one" type="BeanOne"/>
<util:bean id="two" type="BeanTwo"/>
<util:if name="one" property="bean" id="two">
... one.bean == two
</util:if>