JSF2.0中的ui:repeat标记的文档说明您可以遍历ResultSet,但我的代码是:
<ui:repeat value="#{bean.resultSet}" var="row" varStatus="status">
#{row.string("mySQLColumn")}
</ui:repeat>产生以下错误:
javax.faces.FacesException: Iteration start index is greater than the number of available rows.
at com.sun.faces.facelets.component.UIRepeat.validateIterationControlValues(UIRepeat.java:682)
at com.sun.faces.facelets.component.UIRepeat.process(UIRepeat.java:505)
at com.sun.faces.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:974)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)发布于 2011-10-23 04:17:59
尽管它似乎被支持作为迭代的参数,但最好先将其转换为List,然后再迭代。
这样,您就不会将数据库访问技术传播到视图层。
https://stackoverflow.com/questions/7862100
复制相似问题