永发信息网

struts2 标签 怎样取出iterator的一行数据

答案:2  悬赏:20  手机版
解决时间 2021-02-06 19:45
<s:iterator value="ptvList" var="item" status="st">
<td><s:property value="ptvList.get(#st.index).id.name" /></td>
这样可以打印出数据
<s:if test='%{<s:property value="ptvList.get(#st.index)" /> != null}'>
这样却报空

请大神帮忙!!!
最佳答案
struts2的iterator标签有begin和end属性

<tag>
<description><![CDATA[Iterate over a iterable value]]></description>
<name>iterator</name>
<tag-class>org.apache.struts2.views.jsp.IteratorTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description><![CDATA[if specified the iteration will start on that index]]></description>
<name>begin</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description><![CDATA[if specified the iteration will end on that index(inclusive)]]></description>
<name>end</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description><![CDATA[Deprecated. Use 'var' instead]]></description>
<name>id</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description><![CDATA[If specified, an instanceof IteratorStatus will be pushed into stack upon each iteration]]></description>
<name>status</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description><![CDATA[if specified the iteration index will be increased by this value on each iteration. It can be a negative value, in which case 'begin' must be greater than 'end']]></description>
<name>step</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description><![CDATA[the iteratable source to iterate over, else an the object itself will be put into a newly created List]]></description>
<name>value</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description><![CDATA[Name used to reference the value pushed into the Value Stack]]></description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<dynamic-attributes>false</dynamic-attributes>
</tag>
struts-tag.tld文件中的代码
<tag>
<name>iterator</name>
<tag-class>org.apache.struts2.views.jsp.IteratorTag</tag-class>
<body-content>JSP</body-content>
<description><![CDATA[Iterate over a iterable value]]></description>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description><![CDATA[id for referencing element. For UI and form tags it will be used as HTML id attribute]]></description>
</attribute>
<attribute>
<name>status</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description><![CDATA[If specified, an instanceof IteratorStatus will be pushed into stack upon each iteration]]></description>
</attribute>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description><![CDATA[the iteratable source to iterate over, else an the object itself will be put into a newly created List]]></description>
</attribute>
</tag>
全部回答
好像有个属性 status ,值是当前遍历的这个集合的下标,可以用这个来作为的id,点击的时候,直接传当前点击的行的id,js里对他进行操作
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
金宝贝游戏教室地址有知道的么?有点事想过去
逸品轩茶馆在什么地方啊,我要过去处理事情
电影地址有知道的么?有点事想过去
1900年8月,联军占领北京,大肆烧杀抢掠,把
城市便捷酒店连锁梧州汽车站店地址有知道的么
茶叶水沏好后过一会变味了怎么会事
色虫网有毒吗?
求小说,异界大陆的,主角可以通过道具兑换各
星空动漫城地址在什么地方,想过去办事
尿毒症患者穿过的衣服普通人可以穿吗?
去日本的机票多少钱?
棒球服怎么搭配裤子男,棒球服配什么裤子男
歌词我们爱到最后,谁都不肯放手. 跪求革命
泰兰特在哪些奥特曼剧集里出现过,说最多的评
海天手机航母店怎么去啊,有知道地址的么
推荐资讯
什么是不动产,通俗点解释。
石头湾村地址在哪,我要去那里办事
西昌市人民医院做唐氏筛查需要预约吗
广州哪里有做微信公众号开发的
第一天去大企业的办公室上班,请问该注意些什
国际收支逆差时,可以采用()。A.紧的财政政策
常州市精迪阀门控制有限公司在哪里啊,我有事
豪创灯饰这个地址在什么地方,我要处理点事
为什么香港很多人用LG,三星的手机,LG居多
集合间的基本关系··
粉刷要用什么工具?全部。
零售一瓶"雪花"啤酒2.8元,买一箱28.8元(一箱
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?