struts2 标签实战整理
2011-08-20 16:50
435 查看
List中存放一个Map,利用<s:iterator/>标签显示例子如下:
其中detailList是List的名字(必须和后台返回的List名字相同),hashMap是其中存放的Map的一个代号。
#hashMap.seat中seat是Map中的key。
< s:iterator value = "detailList" id = "hashMap" >
< tr >
< td > < s:property value = "#hashMap.seat" /> </ td >
< td > < s:property value = "#hashMap.specialOffer" /> </ td >
< td > < s:property value = "#hashMap.price" /> </ td >
< td > < s:property value = "#hashMap.preferentialPrice" /> </ td >
< td > < s:property value = "#hashMap.returnPoint" /> </ td >
< td > < s:property value = "#hashMap.remainMoney" /> </ td >
< td > < s:property value = "#hashMap.direction" /> </ td >
< td > < s:property value = "#hashMap.releaseMan" /> </ td >
< td > < input type = "button" value = "订票" > </ input > </ td >
</ tr >
</ s:iterator >
对于careerpersonList
[
{cp_url=null, cp_id=1, cp_title=www, cp_content=wwwwwww,
cp_pubtime=2011-08-13, cp_author=admin, cp_filename=null},
{cp_url=null, cp_id=2, cp_title=hc, cp_content=hchchc,
cp_pubtime=2011-08-18, cp_author=admin, cp_filename=null},
{cp_url=null, cp_id=3, cp_title=zx, cp_content=zxzxzx,
cp_pubtime=2011-08-17, cp_author=admin, cp_filename=null},
{cp_url=null, cp_id=4, cp_title=yf, cp_content=yfyfyf,
cp_pubtime=2011-08-16, cp_author=admin, cp_filename=null},
{cp_url=null, cp_id=5, cp_title=fys, cp_content=ssssfffsssyyy,
cp_pubtime=2011-08-15, cp_author=admin, cp_filename=null}
]
迭代输出
<s:iterator value="careerpersonList"
status="sta">
<s:property
value="#sta.getIndex()+1" />:
<s:iterator>
<s:a
url="#">
<span
class="colorize">
<s:if
test="key=='cp_title'">
<s:property
value="value.substring(0,2)"/>
</s:if>
</span>
</s:a>
</s:iterator>
<br
/>
<hr
/>
</s:iterator>
<s:iterator
value="careerpersonList" status="sta" id="cl">
<s:property value="#cl.cp_title.substring(0,8)" /><br/><hr/>
</s:iterator>
其中detailList是List的名字(必须和后台返回的List名字相同),hashMap是其中存放的Map的一个代号。
#hashMap.seat中seat是Map中的key。
< s:iterator value = "detailList" id = "hashMap" >
< tr >
< td > < s:property value = "#hashMap.seat" /> </ td >
< td > < s:property value = "#hashMap.specialOffer" /> </ td >
< td > < s:property value = "#hashMap.price" /> </ td >
< td > < s:property value = "#hashMap.preferentialPrice" /> </ td >
< td > < s:property value = "#hashMap.returnPoint" /> </ td >
< td > < s:property value = "#hashMap.remainMoney" /> </ td >
< td > < s:property value = "#hashMap.direction" /> </ td >
< td > < s:property value = "#hashMap.releaseMan" /> </ td >
< td > < input type = "button" value = "订票" > </ input > </ td >
</ tr >
</ s:iterator >
对于careerpersonList
[
{cp_url=null, cp_id=1, cp_title=www, cp_content=wwwwwww,
cp_pubtime=2011-08-13, cp_author=admin, cp_filename=null},
{cp_url=null, cp_id=2, cp_title=hc, cp_content=hchchc,
cp_pubtime=2011-08-18, cp_author=admin, cp_filename=null},
{cp_url=null, cp_id=3, cp_title=zx, cp_content=zxzxzx,
cp_pubtime=2011-08-17, cp_author=admin, cp_filename=null},
{cp_url=null, cp_id=4, cp_title=yf, cp_content=yfyfyf,
cp_pubtime=2011-08-16, cp_author=admin, cp_filename=null},
{cp_url=null, cp_id=5, cp_title=fys, cp_content=ssssfffsssyyy,
cp_pubtime=2011-08-15, cp_author=admin, cp_filename=null}
]
迭代输出
<s:iterator value="careerpersonList"
status="sta">
<s:property
value="#sta.getIndex()+1" />:
<s:iterator>
<s:a
url="#">
<span
class="colorize">
<s:if
test="key=='cp_title'">
<s:property
value="value.substring(0,2)"/>
</s:if>
</span>
</s:a>
</s:iterator>
<br
/>
<hr
/>
</s:iterator>
<s:iterator
value="careerpersonList" status="sta" id="cl">
<s:property value="#cl.cp_title.substring(0,8)" /><br/><hr/>
</s:iterator>
相关文章推荐
- Struts2 标签使用小结(转帖整理)
- SSH实战OA 05:Struts2标签
- 整理struts2所有标签
- Struts2的标签库整理
- struts2 s:if标签以及 #,%{},%{#} 资料整理
- Struts2标签大全,个人整理struts标签全、struts2标签全集学习
- Struts2标签库整理【完整】
- struts2标签常用整理
- struts2标签总结_动力节点Java学院整理
- Struts2标签库整理【完整】
- struts2笔记整理第四天(项目实战)
- struts2 s:if标签以及 #,%{},%{#}的使用方法等在资料整理
- Struts2标签库整理
- struts2 taglib struts标签学习整理中
- struts2 taglib struts标签学习整理中
- Struts2标签库整理【完整】
- Struts2 s:if标签以及 #,%{},%{#}的使用方法等在资料整理
- struts2 s:if标签以及 #,%{},%{#}的使用方法等在资料整理
- Struts2标签库整理【完整】