<fieldset class="fieldset">
<legend class="legendtitle">DEDUCTIONS</legend>
<table width="100%" border="0" cellspacing= "0" cellpadding="0">
<tr>
<td class="Htd_one1" width="20%"><div align="center">Component</div></td>
<td class="Htd_one1" width="20%"><div align="center">Allocated</div></td>
</tr>
<s:iterator value="%{#resultLists.deductionLists}" id="hrEmpSalaryCompDeductionList"
status="stat">
<s:if test="%{#allowanceList.allocatedSalAmount > 0}">
<tr>
<td class="labelone1" >
<div align="center">
<s:property value="%{#allowanceList.componentDesc}" />
</div>
</td>
<td class="dataone1" >
<div align="right">
<s:property value="%{#allowanceList.allocatedSalAmount}" />
</div>
</td>
</tr>
</s:if>
</s:iterator>
</table>
</fieldset>如果迭代器列表resultLists.deductionLists中的allowanceList.allocatedSalAmount的值都不大于0,我需要隐藏整个字段集。
我想调用JavaScript并传递resultLists.deductionLists的值,然后在任何allowanceList.allocatedSalAmount大于0的情况下设置一个计数器。
但是如何将resultLists.deductionLists的列表值传递给JavaScript并从中访问所有的allowanceList.allocatedSalAmount呢?
发布于 2016-02-15 17:08:21
要隐藏整个fieldset,你必须用<s:if>标签包装它。
<s:if test="%{#allowanceList.allocatedSalAmount > 0}">
<fieldset class="fieldset">
<legend class="legendtitle">DEDUCTIONS</legend>
<table width="100%" border="0" cellspacing= "0" cellpadding="0">
<tr>
<td class="Htd_one1" width="20%"><div align="center">Component</div></td>
<td class="Htd_one1" width="20%"><div align="center">Allocated</div></td>
</tr>
<s:iterator value="%{#resultLists.deductionLists}" id="hrEmpSalaryCompDeductionList"
status="stat">
<tr>
<td class="labelone1" >
<div align="center">
<s:property value="%{#allowanceList.componentDesc}" />
</div>
</td>
<td class="dataone1" >
<div align="right">
<s:property value="%{#allowanceList.allocatedSalAmount}" />
</div>
</td>
</tr>
</s:iterator>
</table>
</fieldset>
</s:if>因为在fieldset中一次只能迭代一个列表,所以不能让同一个迭代器迭代两个列表。您必须在<s:if>标记中定义要计算的适当表达式,以决定是否应该显示字段集。
https://stackoverflow.com/questions/35404333
复制相似问题