| < Day Day Up > |
|
The <logic:notEmpty /> tag evaluates its body if either the named scripting variable or property of the named scripting variable is not equal to null or an empty string. The <logic:notEmpty /> tag has a body type of JSP and supports three attributes, described in Table 18.2.
Attribute | Description |
---|---|
name | Specifies a scripting variable to be used as the variable being tested. (Required) |
property | Specifies the data member of the scripting variable to be tested. (Optional) |
scope | Defines the scope of the bean specified by the name attribute. If the scope attribute is not specified, then the tag will search for the bean in the scopes, in the order of page, request, session, and application. (Optional) |
An example of using the <logic:notEmpty /> tag is shown here:
<logic:notEmpty name="user"> Welcome to our Struts application. </logic:notEmpty>
In this example, we test the scripting variable user. If this variable is not null and does not contain an empty string, then the body will be evaluated, which will result in the body of the tag being evaluated.
| < Day Day Up > |
|