标签:struts2 字符 注意 else mil cin inpu context plist
public String putListToMap(){
List<Person> personList = new ArrayList<Person>();
Person p= null;
for (int i
= 0; i < 50; i++) {
p= new Person();
if(i%3==0){
p.setPid( "aa");
p.setUsername( "P"+i);
}
if(i%3==1){
p.setPid( "bb");
p.setUsername( "p"+i);
}
if(i%3==2){
p.setPid( "cc");
p.setUsername( "p"+i);
}
personList.add(p);
}
ActionContext. getContext().put("pList",
personList);
return "list_map" ;
}
|
<style type= "text/css">
.odd{
background-color:red ;
}
.even{
background-color:blue ;
}
.blue{
background-color:yellow ;
}
.red{
background-color:red ;
}
</style >
<s:iterator value= "#pList" var ="aa" status="statu">
<!-- 每三行变色 status 使用s:debug能够查看到该类为IteratorStatus
-->
<tr class= "<s:property value="#statu.index%3==0?‘blue‘:‘red‘" />">
<%--<tr class="<s:property
value="#statu.even?‘even‘:‘odd‘"/>">
--%>
<td>
<s:property value= "pid"/>
</td>
<td>
<s:property value= "username"/>
</td>
<td>
<s:property value="#statu.count" />
</td>
<td>
<s:if test= "#statu.odd">
奇数行
</s:if>
<s:elseif test= "#statu.even">
偶数行
</s:elseif>
</td>
<td>
<s:property value="#statu.index" />
</td>
<td>
<s:if test="pid==‘aa‘||pid==‘bb‘" >
<input type= "button" name="adsf" value="改动">
</s:if>
</td>
<td>
<s:if test="pid==‘cc‘||pid==‘aa‘" >
<input type= "button" name="adsf" value="删除">
</s:if>
</td>
</tr>
</s:iterator>
|
【Struts2五】ValueStack以及ognl表达式二(经常使用标签)
标签:struts2 字符 注意 else mil cin inpu context plist
原文地址:http://www.cnblogs.com/liguangsunls/p/6852665.html