`
nbzhou0815
  • 浏览: 691 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

struts2 iterator相关问题

阅读更多
许久没有使用struts2   最近兴起复习了下   生疏了许多 总结几点遇到的问题


jsp页面:
 <table>
       	<s:iterator value="tests" status="index">
 			<s:if test="#index.last"><br/></s:if> 
 			<s:iterator value="Test">  
 				<tr class='<s:if test="#index.even">row-even</s:if><s:else>row-odd</s:else>'> 
 				<td><s:property value="[1].id"/></td>
 				<td><s:property value="[1].name"/></td>
 				<td><s:property value="[1].age"/></td>
 				<td><s:property value="[1].sex"/></td>
 				<td><s:property value="[1].password"/></td>
 				</tr>
 			</s:iterator>
 		</s:iterator>    </table>
<style>
.row-even{background:#def7c2;}  /*偶数行样式*/ 
.row-odd{background:#c8e7a6;}   /*奇数行样式*/ 
</style>






action代码:
public ITestDAO testDAO;
	public Test test = new Test();
	public String name;
	public Integer sex;
	public Integer age;
	public String password;
	public List<Test> tests;
	public String getTest(){
		tests = testDAO.findAll();
		return SUCCESS;
	}



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics