The if tag tests the specified property and includes the tag body if the property evaluates to true.
JSP
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.
This tag has the following attributes for which the Required value are “Yes” and “No”:
Name of the bean to use.
Name of the property to test.
String value of the property to test.
Bean object value of the property to test.
None.
<%-- 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>