我的例子给你看看:
ArrayList arraylist = new ArrayList();
HashMap hm = null;
while(rs.next()){
hm = new HashMap();
hm.put("id",rs.getString("stor_id"));
hm.put("flag",rs.getString("ord_num"));
hm.put("quantity",rs.getString("qty"));
hm.put("description",rs.getString("payterms"));
hm.put("fuser",rs.getString("ord_date"));
arraylist.add(hm);
}
httpServletRequest.setAttribute("finance",arraylist);
...<logic:iterate id="a" name="finance" offset="<%=offset.toString()%>" length="10">
<tr><td ><bean:write name="a" property="id"/></td>
<td ><bean:write name="a" property="flag"/></td>
<td ><bean:write name="a" property="description"/></td>
<td ><bean:write name="a" property="quantity"/></td>
<td ><bean:write name="a" property="fuser"/></td></tr>
</logic:iterate>
ArrayList arraylist = new ArrayList();
HashMap hm = null;
while(rs.next()){
hm = new HashMap();
hm.put("id",rs.getString("stor_id"));
hm.put("flag",rs.getString("ord_num"));
hm.put("quantity",rs.getString("qty"));
hm.put("description",rs.getString("payterms"));
hm.put("fuser",rs.getString("ord_date"));
arraylist.add(hm);
}
httpServletRequest.setAttribute("finance",arraylist);
...<logic:iterate id="a" name="finance" offset="<%=offset.toString()%>" length="10">
<tr><td ><bean:write name="a" property="id"/></td>
<td ><bean:write name="a" property="flag"/></td>
<td ><bean:write name="a" property="description"/></td>
<td ><bean:write name="a" property="quantity"/></td>
<td ><bean:write name="a" property="fuser"/></td></tr>
</logic:iterate>
解决方案 »
- 百万记录的表,like查询索引不起作用,如何解决呢
- 找不到spring的配置文件路径
- 关于spring的问题
- hibernate异常could not deserialize,初学帮分析一下
- 急得厕所都不敢上,兄弟们快帮我来看看
- 赶着救火的!一个很简单的问题!
- 我为什么不能用JAVAMAIL发邮件?
- 讨论,复杂流程的中订单的状态
- jbuilder9 中自带的例子,Esite (for weblogic) 运行时候出错:(急等)
- 如何判断一个服务是否可用?
- 紧急求救:当jtable的width,height变化时如何能监听到这些变化的事件!!!!!!!!!!!!
- 除了做网页,JAVA到底有什么用。困惑呀。帮忙解惑吧
public class Uset(){
private String name;
private String type;
//写出set get 方法
}
for(int i=0;i<3;i++){
User uu=New user();
uu.setUserType("a");
un.setUserName("b");
list.add(un);
}
pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
<logic:present name="aa">
<logic:iterate id="item" name="list" > <bean:write name="item" property="userType" />
<bean:write name="item2" property="userName" /></logic:iterate>
</logic:present>
<logic:iterate id="item" name="list" > <bean:write name="item" property="userType" />
<bean:write name="item" property="userName" /></logic:iterate>
</logic:present>
再定义一个userList
UserForm userform=(UserForm)context.getActionForm();
java.util.ArrayList list = new java.util.ArrayList();
for(int i=0;i<3;i++){
UserForm uu=New UserForm();
uu.setUserType("a");
un.setUserName("b");
list.add(un);
}
userform.setUserList(list);
context.setActionForm(userform);
<logic:iterate name="userform" property="userList" indexId="nums" id="vo">
<tr>
<td > <%=nums.intValue()+1%></div></td>
<td > <bean:write name="vo" property="uerType" ignore="true"/></div></td>
<td> <bean:write name="vo" property="userName" ignore="true"/></div></td>
</tr>
</logic:iterate>