struts2 iterator中if标签的使用
2016-06-20 18:26
435 查看
今天碰到个问题,数据库中有个字段,现实到页面上时需要根据字段值判断是否显示为超链接,以前都是直接判断是否等于某数值,但这次取出来以后是字符串,结果判断时候出问题,最后解决如下,看代码:
moList为action传过来一个List。
其中在:<s:if test="#mo.materialsOutState == '已发送'">中,
单,双引号互换没任何影响的。
<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 == '已发送'">中,
单,双引号互换没任何影响的。
相关文章推荐
- 关于android studio与eclipse的比较
- 【Struts1】--beanutils
- 【java细节】 JAVAWeb部署经验:Maven包丢失、打包缺jar、classNotFound等
- 【Struts】--编程式异常
- part1: maven 工程整合spring+activemq
- 【ssh】struts2 返回 json 的使用
- JFinal集成Activiti流程引擎(不使用Spring)
- java设计模式之装饰模式
- Spring Security hello world example
- loadrunner启动java客户端程序
- 【SSH】利用struts2 特性 导出excel
- java数组的拷贝四种方法:for、clone、System.arraycopy、arrays.copyof
- Java - PAT - 1037. 在霍格沃茨找零钱(20)
- 第一篇博客,JAVA初学心得,Static
- Springmvc层架构
- java生成execl下拉列表
- java InputStreamheOutputStream的用法讲义
- eclipse控制台中文乱码
- java socket长连接
- Java的堆和栈