By Alvin Riley,2014-10-09 10:22
13 views 0

当指定的值为不为null, 空字符串, 或者是空的java.util.Collection,或者



     Person person = new Person();



     request.setAttribute("toms", person);


    <logic:notEmpty name="toms">

     bean is not empty



    <logic:notEmpty name="toms" property="name">

     property name is not empty


    notEmpty - Evaluate the nested body content of this tag if the requested variable is neither null, nor an empty string, nor an empty java.util.Collection (tested by the .isEmpty() method on the java.util.Collection interface).

    This tag evaluates its nested body content only if the specified value is present (i.e. not null) and is not an empty string (i.e. a java.lang.String with a length of zero).

    JSTL: The equivalent JSTL tag is <c:if> using the ! empty operator. For example,

    <c:if test="${ ! empty sessionScope.myBean.myProperty}"> do something </c:if>

    Attribute Description Name

    The variable to be compared is the JSP bean specified by

    this attribute, if property is not specified, or the value

    of the specified property of this bean, if property is name specified.

    [RT Expr]

    The variable to be compared is the property (of the bean

    specified by the name attribute) specified by this

    property attribute. The property reference can be simple, nested,

    and/or indexed.

    Attribute Description Name

    [RT Expr]

    The bean scope within which to search for the bean named

    by the name property, or "any scope" if not specified. scope

    [RT Expr]

Report this document

For any questions or suggestions please email