我无法在List< String>中形成表格使用struts 2标签 [英] I am unable to form table in List<String> using struts 2 tags
本文介绍了我无法在List< String>中形成表格使用struts 2标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用struts 2并且我正在使用iterator标签,当我习惯迭代List我失败时从集合中获取值并创建表,其中List中的值是动态的。
i am using struts 2 and i am using iterator tag , when i used to iterate List i failed get the value and create table from collection , where value in List is dynamic.
提前致谢
推荐答案
我相信你正在创建 list< String>
在你在jsp中迭代的动作类中
I believe you are creating list<String>
in your action class which you are iterating in your jsp
public class IteratorAction extends ActionSupport{
private List<String> list;
public List<String> getList() {
return list;
}
public void setlist(List<String> list) {
this.list= list;
}
public String execute() {
list= new ArrayList<String>();
list.add("A");
list.add("B");
list.add("C");
list.add("D");
list.add("E");
list.add("F");
return SUCCESS;
}
}
你可以在你的jsp中使用那个列表
you can use that list in your jsp like
<table>
<s:iterator value="list" status="listStatus">
<tr>
<s:if test="#listStatus.even == true">
<td style="background: #CCCCCC"><s:property/></td>
</s:if>
<s:elseif test="#listStatus.first == true">
<td><s:property/> (This is first value) </td>
</s:elseif>
<s:else>
<td><s:property/></td>
</s:else>
</tr>
</s:iterator>
</table>
我希望如果您有不同的要求,这将有助于您了解详细信息,只有一些人可以以最佳方式帮助您
i hope this will help you if you have diffrent requirement lets us know with details only than some one can help you in best possible way
这篇关于我无法在List< String>中形成表格使用struts 2标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文