session传对象的问题
我在开始页面中把col是Collection类型的对象 放在session中
session.setAttribute("product",col);
在另一个页面中
Collection coll =session.getAttribute("product");
编译时有错
我改成
Collection coll=(Collection)session.getAttribute("pruduct");
Iterator it=coll.iterator();
while(it.hasNext()){
ProductInfo pi=(ProductInfo)it.next();
。。。。
。。。
编译通过
但运行时ProductInfo pi=(ProductInfo)it.next();这句话有异常
ApplicationDispatcher[/demo]: Servlet.service() for servlet debugjsp threw exception
java.lang.ClassCastException
at org.apache.jsp.search_0005fresult$jsp._jspService(search_0005fresult$jsp.java:72)