logic:notEmpty

 < Day Day Up > 



<logic:notEmpty />

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.

Table 18.2: <logic:notEmpty /> Tag Attributes

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 > 



Professional Jakarta Struts
Professional Jakarta Struts (Programmer to Programmer)
ISBN: 0764544373
EAN: 2147483647
Year: 2003
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net