您的位置:首页 > 编程语言 > Java开发

struts2 iterator中if标签的使用

2016-06-20 18:26 435 查看
今天碰到个问题,数据库中有个字段,现实到页面上时需要根据字段值判断是否显示为超链接,以前都是直接判断是否等于某数值,但这次取出来以后是字符串,结果判断时候出问题,最后解决如下,看代码:

<s:iterator value="moList" id="mo">
<tr>
<td bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><s:property value="materialsOutGetStaffName"/></span></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><s:property value="materialsOutDate"/></span></div></td>
<td bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">
<s:if test="#mo.materialsOutState == '已发送'">
<s:a href="goUpdateStateAction.action?repairSuppliesOutput.repairSuppliesOutputId=${materialsOutId}" cssStyle="color:blue;"><s:property value="materialsOutState"/></s:a>                </s:if>
<s:elseif test="#mo.materialsOutState == '已完成'">
<s:property value="materialsOutState"/>
</s:elseif>
</span></div></td>
<td bgcolor="#FFFFFF"><div align="center"><span class="STYLE1"><a href="materialsOutDetailListAction.action?repairSuppliesOutput.repairSuppliesOutputId=${materialsOutId}" mce_href="materialsOutDetailListAction.action?repairSuppliesOutput.repairSuppliesOutputId=${materialsOutId}">详细情况</a></span></div></td>
</tr>
</s:iterator>


moList为action传过来一个List。

其中在:<s:if test="#mo.materialsOutState == '已发送'">中,
单,双引号互换没任何影响的。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: