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

posted @ 2016-06-20 18:26  坚哥威武  阅读(389)  评论(0编辑  收藏  举报