请教<logic:iterate>的使用 后台有个List数组taskName,我在前台怎么用<logic:iterate>的嵌套循环把List数组中的数据循环出来啊!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个标记用于循环下面是一个例子 <logic:iterate id="prinfo"--session中javaBean的别名 name="c_prinfo"--session中集合的名称 scope="session"> --代表这个集合从session中获得 <tr> <td><bean:write name="prinfo" property="prname" /></td> </logic:iterate> 其中bean:write的说明: name:与iterate中的id值对应,。 property:代码这个bean的属性名,这将获得这个属性的值。 <% HashMap months=new HashMap(); months.put("Jan.","January"); months.put("Feb.","February"); request.setAttribute("months",months);%><logic:iterate id="element" name="months"><bean:write name="element" property="key"/><bean:write name="element" property="value"/></logic:iterate><% Vector animals=new Vector(); animals.addElement("Dog"); animals.addElement("Cat"); animals.addElement("Bird"); animals.addElement("Chick"); request.setAttribute("Animals", animals);%><logic:iterate id="element" name="Animals"> <bean:write name="element"/><BR></logic:iterate><p>给你这两段程序看,应该就差不多该明白了吧 楼上的例子是不是ACCP的啊,经典啊。 1楼没错啊,如果List中不是对象的话,这样用<logic:iterate id="prinfo" name="c_prinfo"--session中集合的名称 scope="session"> --代表这个集合从session中获得 <tr> <td><bean:write name="prinfo" /></td> </logic:iterate> 我的是list数组,数组中每个元素是一个List对象,每个list对象里存放了多个javabean,应该怎么循环啊!请指教! 这不简单吗,两重循环 <logic:iterate id="prinfo" name="c_prinfo" scope="session"> <logic:iterate id="aaBean" name="prinfo"> <bean:write name="aaBean" property="prname" /> </logic:iterate></logic:iterate>设置id的作用就是方便嵌套在里面使用的 一楼对ID的理解明显不对,id是用来标识检索出的元素的! 利用JS动态添加多个文本框 不知道如何将文本框的值存入数据库 Struts中的Action与Servlet有什么关系没有啊? 关于一个任务池的开发思路,大家来讨论一下 list 求,现在开发基于B/S结构的MIS系统的技术选择 求解:struts框架问题 为什么在插入大数量量时TOMCAT会出现错误? 有关WebSphere服务器“文根”的设置问题(高手请进,高分相送) 关于等待返回页面的问题 关于Class的问题。 各位高手,求助,急!提交插入SQL的都是NULL! spring 入门新手求救:SimpleUrlHandlerMapping映射问题
下面是一个例子
<logic:iterate id="prinfo"--session中javaBean的别名
name="c_prinfo"--session中集合的名称
scope="session"> --代表这个集合从session中获得
<tr>
<td><bean:write name="prinfo" property="prname" /></td>
</logic:iterate>
其中bean:write的说明:
name:与iterate中的id值对应,。
property:代码这个bean的属性名,这将获得这个属性的值。
HashMap months=new HashMap();
months.put("Jan.","January");
months.put("Feb.","February");
request.setAttribute("months",months);
%>
<logic:iterate id="element" name="months">
<bean:write name="element" property="key"/>
<bean:write name="element" property="value"/>
</logic:iterate>
<%
Vector animals=new Vector();
animals.addElement("Dog");
animals.addElement("Cat");
animals.addElement("Bird");
animals.addElement("Chick");
request.setAttribute("Animals", animals);
%>
<logic:iterate id="element" name="Animals">
<bean:write name="element"/><BR>
</logic:iterate><p>
给你这两段程序看,应该就差不多该明白了吧
scope="session"> --代表这个集合从session中获得
<tr>
<td><bean:write name="prinfo" /></td>
</logic:iterate>
<logic:iterate id="prinfo" name="c_prinfo" scope="session">
<logic:iterate id="aaBean" name="prinfo">
<bean:write name="aaBean" property="prname" />
</logic:iterate></logic:iterate>设置id的作用就是方便嵌套在里面使用的