QQ863017854
QQ863017854
采纳率87%
2016-04-26 06:00 阅读 2.9k
已采纳

关于jsp用session传递list 在另一页面获取并遍历输出list

如题

 List<shuxing> list = new ArrayList<shuxing>();
   shuxing s=new shuxing();
       while(rs.next()){
        s.setsShopName(rs.getString("sShopName"));
        s.setiNumbHj(rs.getString("iNumbHj"));
        s.setrMoneyHj(rs.getString("rMoneyHj"));
        list.add(s);
       }
       session.setAttribute("rs",list);
        response.sendRedirect("dian.jsp"); 
        conn.close();   

                获取
                <c:forEach items="rs" var="user" >  
     <c:out value="${user.sShopName}"/>
          </c:forEach>  

这样写报错HTTP Status 500 -

type Exception report

message

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

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /dian.jsp at line 55

52: <!-- Codrops top bar --><!--/ Codrops top bar -->
53: <!--

<%Object q=session.getAttribute("rs"); %><%=q %>-->
54:

55:
56:

57: /c:forEach

58:

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    QQ863017854 QQ863017854 2016-04-27 06:00

    已解决

    点赞 评论 复制链接分享
  • wq1009bbbb TheJavaProgramer 2016-04-26 06:28

    items=${rs}

    点赞 评论 复制链接分享

相关推荐