我在servlet里面的语句:ArrayList <introducer> result = PerHandle.queryind(level,name);
request.setAttribute("introducer", result);
然后传递给queryintroducer。jsp
然后获取: ArrayList<introducer> tem =(ArrayList<introducer>) request.getAttribute("introducer");
if(tem==null) System.out.print(6);
它一直输出6 为什么获取不到
大家帮忙看看啊
谢谢
request.getAttribute是获取form中的参数
如:<input type="hidden" value="${introducer}" name="introducer">
像你这种情况应该用:
ArrayList <introducer> result = PerHandle.queryind(level,name);
request.setParameter("introducer", result);
然后传递给queryintroducer。jsp
然后获取: ArrayList<introducer> tem =(ArrayList<introducer>) request.getParameter("introducer");
if(tem==null) System.out.print(6);
就不会输出6了
在页面也需要一个容器保存 introducer 的值!