新手提问,怎样才能取得集合中的元素?在线..............急啊!!!!!!!

bobshi 2003-12-20 10:37:51
用的是struts架构。
在一个action中把一些值放在一个集合中,这些值不能重复,比如是HashSet,
那么我怎样才能在对应的jsp中把这些值显示出来。

对应的action 和jsp怎么写,谢谢!
...全文
48 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
tyouvivi 2003-12-20
  • 打赏
  • 举报
回复
formbean:

public void setUpdateList(ArrayList updateList) {
this.updateList = updateList;
}

public Object getUpdList(int index) {
return updateList.get(index);
}

public void setUpdList(int index , Object value) {
updateList.add(index , value);
}

public ArrayList getDeleteList() {
return deleteList;
}
action:
StrutsDBAccess dbA = new StrutsDBAccess();
ArrayList v = (ArrayList)dbA.find(form);
form.setUpdateList(v);
jsp:
<logic:iterate id="tableA" name="LoginActionForm" property="updateList" indexId="idx" offset='<%=start_idx%>' length='<%=len%>' >
<tr>
<td><html:checkbox name="LoginActionForm" property='<%="v_checkBox["+idx+"]"%>' value="on" /></td>
<td><bean:write name="tableA" property="ID" /></td>
<td><html:text name="LoginActionForm" property='<%="updList["+idx+"].name"%>' size="10" /></td>
<td><html:text name="LoginActionForm" property='<%="updList["+idx+"].address"%>' size="10" /></td>
<td><html:text name="LoginActionForm" property='<%="updList["+idx+"].age"%>' size="10" /></td>
<td><html:text name="LoginActionForm" property='<%="updList["+idx+"].likes"%>' size="10" /></td>
</tr>
</logic:iterate>

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧