zoukankan      html  css  js  c++  java
  • struts2 iterator中if标签的使用

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

    <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 == '已发送'">中,
    单,双引号互换没任何影响的。

  • 相关阅读:
    多态的详解
    Java继承详解
    static关键字特点
    数组(相关知识的整理)
    杨辉三角(用for循环)
    Jmeter接口测试案例实践(一)
    组合测试方法:配对测试实践
    用例设计方法:判定表驱动法实践
    sso系统登录以及jsonp原理
    单点登录--sso系统
  • 原文地址:https://www.cnblogs.com/gwq369/p/5601464.html
Copyright © 2011-2022 走看看