struts2 的s:if用法1-與request中的對象比較值

做了一個界面,大體的需求是:從主畫面傳進一個ID,這個畫面上是所有ID的列表,但是對於傳進來的那條ID對應的記錄,全紅顯示。這樣在s:iterator的時候用了一下s:if
代碼如下

<s:iterator value="equipmentInfos" status="equipmentInfoStatus" id="equipmentInfo">
<s:if test="#equipmentInfoStatus.odd == true">
<tr bgColor="#F9F9F7">
</s:if>
<s:else>
<tr bgcolor="#FFFFFF" >
</s:else>
<s:if test="#request.hostid.equals(#equipmentInfo.equipmentid)">
<td height="20" class="STYLE1BOLD" ><s:property value="equipmentid"/></td>
<td height="20" class="STYLE1BOLD" ><s:property value="equipmentname"/></td>
<td height="20" class="STYLE1BOLD" ><s:property value="equipmenttype"/></td>
</s:if>
<s:else>
<td height="20" class="STYLE1" ><s:property value="equipmentid"/></td>
<td height="20" class="STYLE1" ><s:property value="equipmentname"/></td>
<td height="20" class="STYLE1" ><s:property value="equipmenttype"/></td>
</s:else>

</tr>
</s:iterator>



第一個是判斷奇數偶數行,沒什麼。主要是第二個。如何用request裏面的值和list裏面的值進行比較。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章