al.size() 出现的空指针 也就是 al 为null 了、也就是ArrayList al=(ArrayList)request.getAttribute("mycartinfo"); 这行没有获取到数据al = null 了、doGet 方法里、ArrayList al=mcb.showMyCart(); 这句你debug 看下能获取到null 不?
解决方案 »
- 急急急!SSH问题,No setter found for property 'tTreeDao' in class 'com.web.bo.Home.TTre
- 使用struts和hibernate完成一个注册
- 数据流的读取问题。。。
- struts+iBATIS??
- 求《Birt高级教程(数据源设置和动态Sql)》电子书
- 谁给个hibernate更新的方式
- 请高手进:问一个关于连接池&事务的问题。
- 请教一下关于数据源lookup(jndiName)的问题,急!!!
- 怎么用tomcat?
- 如何根据已知数据,使用java来生成柱状图、和曲线图啊
- 在JSP页面文本框属性readonly问题
- 购物车修改商品数量页面数据丢失了
al放入request中了,跳转到shopping3.jsp的时候不知道有没有把al从request中取出来。
我也刚学这个,说的不对的请多指教。
接2楼的
jsp中
加上这句话<s:debug></s:debug>,
然后看看ValueStack中有木有
MycartBo mcb=(MycartBo)request.getSession().getAttribute("mycart");
ArrayList al=mcb.showMyCart();
//把al放入request
request.setAttribute("mycartinfo", al);