首页新闻找找看学习计划

jsp中forEach遍历list集合出现问题?

0
[已关闭问题] 关闭于 2018-12-01 22:13

jsp部分代码如下
<c:forEach items="${bookList }" var="book">
<div class="icon">
<a href="<c:url value='/BookServlet?method=load&bid=${book.bid }'/>"><img src="<c:url value='/${book.image }'/>" border="0"/></a> <br/>
<a href="<c:url value='/BookServlet?method=load&bid=${book.bid }'/>">${book.bname }</a>
</div>
</c:forEach>
浏览器访问报错
HTTP Status 500 - org.apache.jasper.JasperException: An exception occurred processing JSP page /jsps/book/list.jsp at line 35
type Exception report

message org.apache.jasper.JasperException: An exception occurred processing JSP page /jsps/book/list.jsp at line 35

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.lang.RuntimeException: org.apache.jasper.JasperException: An exception occurred processing JSP page /jsps/book/list.jsp at line 35

32:
33: <body>
34:
35: <c:forEach items="${bookList }" var="book">
36: <div class="icon">
37: <a href="<c:url value='/BookServlet?method=load&bid=${book.bid }'/>"><img src="<c:url value='/${book.image }'/>" border="0"/></a>
38: <br/>

Stacktrace:
cn.itcast.bookstore.utils.BaseServlet.service(BaseServlet.java:66)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause

org.apache.jasper.JasperException: An exception occurred processing JSP page /jsps/book/list.jsp at line 35

32:
33: <body>
34:
35: <c:forEach items="${bookList }" var="book">
36: <div class="icon">
37: <a href="<c:url value='/BookServlet?method=load&bid=${book.bid }'/>"><img src="<c:url value='/${book.image }'/>" border="0"/></a>
38: <br/>

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
cn.itcast.bookstore.utils.BaseServlet.service(BaseServlet.java:57)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
org.apache.jsp.jsps.book.list_jsp._jspService(list_jsp.java:117)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
cn.itcast.bookstore.utils.BaseServlet.service(BaseServlet.java:57)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause

javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>
org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:255)
org.apache.taglibs.standard.tag.common.core.ForEachSupport.supportedTypeForEachIterator(ForEachSupport.java:219)
org.apache.taglibs.standard.tag.common.core.ForEachSupport.prepare(ForEachSupport.java:137)
javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:227)
org.apache.jsp.jsps.book.list_jsp._jspx_meth_c_005fforEach_005f0(list_jsp.java:139)
org.apache.jsp.jsps.book.list_jsp._jspService(list_jsp.java:104)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
cn.itcast.bookstore.utils.BaseServlet.service(BaseServlet.java:57)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

不知道怎么回事。是缺少啥导致不能解析<c:forEach items="${bookList }" var="book">
请大神赐教!

&竹的主页 &竹 | 菜鸟二级 | 园豆:210
提问于:2018-12-01 21:43
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册