下面的代码有什么问题吗?我总是在第一个if表达式中得到false,而不管这两个变量是否为空。
<s:if test="%{!empty #property.propertyTypeZhcn || !empty #property.propertyAge}">
<div id="mini_hosedetail_text">
<s:if test="%{!empty #property.propertyTypeZhcn}">
<p>propertyType:<s:property value="fullPropertyDetail.propertyTypeZhcn"/></p>
</s:if>
<s:if test="%{!empty #property.propertyAge }">
<p>PropertyAge:<s:property value="fullPropertyDetail.propertyAge"/></p>
</s:if>
</div>
</s:if>发布于 2014-08-13 00:18:54
更新:我发现了哪里出了问题:
所以代码应该是,这对我来说是有效的。
<s:if test="%{property.propertyTypeZhcn!= null || property.propertyAge != null}">
<div id="mini_hosedetail_text">
<s:if test="%{property.propertyTypeZhcn != null}">
<p>propertyType:<s:property value="fullPropertyDetail.propertyTypeZhcn"/> </p>
</s:if>
<s:if test="%{property.propertyAge != null}">
<p>PropertyAge:<s:property value="fullPropertyDetail.propertyAge"/></p>
</s:if>
</div>
</s:if>https://stackoverflow.com/questions/25265811
复制相似问题