使用Struts2检查集合是否为空

Ang*_*Bad 0 jsp struts2

我想在jsp页面中进行以下交互

    <s:iterator value="familiari" status="entry">
        <div id="familiare'<s:property value="#entry.index" />'" style="margin:1% 1%; float:left; width: 48%;">
            <h3><a href="#"><s:property value="nome"/>&nbsp;<s:property value="cognome"/></a></h3>
            <div style="padding:5px;">
                <label><s:text name="detraz.cf"/></label> <s:property value="codiceFiscale"/>
                <label><s:text name="detraz.relParent"/></label> <s:property value="descRelParentale"/>
                <br />
                <br />
                <label><s:text name="detraz.dataNascita"/></label> <s:property value="dataNascita"/><br />
                <label><s:text name="detraz.comuneNascita"/></label> <s:property value="comuneNascita"/><br />
                <label><s:text name="detraz.provNascita"/></label> (<s:property value="provinciaNascita"/>)<br />
                <br />
                <label><s:text name="detraz.indResidenza"/></label><br />
                <s:property value="indirizzo"/><br />
                <s:property value="cap"/>&nbsp;<s:property value="comune"/>&nbsp;(<s:property value="provincia"/>)<br />
                <s:property value="stato"/>
                <s:url id="ajaxModifyAction" value="detraz_getDettagliFamilare"/>
                <button id="modifica-<s:property value="#entry.index" />" style="float:right;"><s:text name="button.modifica"></s:text></button>            
            </div>
        </div>          
    </s:iterator>
Run Code Online (Sandbox Code Playgroud)

如何使用Struts2 If语句检查familiari List是否为空?

nmc*_*nmc 6

要检查您的列表是否为空,您可以执行以下操作:

<s:if test="%{getFamiliari().isEmpty()}">
...
</s:if>
Run Code Online (Sandbox Code Playgroud)