List<TextBean> list = new ArrayList<TextBean>();
for(....) {
TextBean textBean = new TextBean();
......
list.add(textBean)
}
request.setAttribute("textBean", textBean);
public class TextBean {
private String a ;
.....
get()...
set()...
}我只会这么写<%
ArrayList list = <ArrayList>request.getAttribute("textBean", textBean);
for(int i=0;i<list.size();i++) {
TextBean textBean = (TextBean)list.get(i);
}
%>
请问下:1.struts该如何怎么写
下面的写法报错:<logic:iterate id="str" name="textBean" scope="request">
<logic:iterate id="ref" name="str" property="a">
<bean:write name="ref"/>
</logic:iterate>
</logic:iterate>报错:Cannot create iterator for this collection
2.jstl中又该怎么写?
解决方案 »
- Hibernate分页中遇到实例化Dao类时出现问题
- 用Struts2发布一个页面,浏览时系统弹出错误框并且页面无法显示!!!!
- java CacheRowSet 获取ORACLE10G的数据的时候 报异常Invalid scale size Cannot be less than zero
- Struts1.2+hibernate2+spring2.5+displaytag1.11配置出错!求救!!
- 关于 org.springframework.jdbc.object.SqlUpdate
- struts标签错误,大家帮忙看看?
- 知道一个类的名字,怎样使用它来创建对象。
- ***EJB是基于哪些技术实现的?***
- 如果不是XML文件,仅仅保存在字符串中的一个片断,该如何处理?
- 清高手介绍一个Java+XML的例子!!!!!
- 文件读写问题——请教高手!
- 对于数据库持久特性是什么?
<bean:write name="str" property="a"/>
</logic:iterate>2、JSTL: <c:forEach items="${requestScope.textBean}" var="str">
<c:out value="${str.a}"/>
</c:forEach>