Posted on 2006-12-02 15:38 
码农cz 阅读(251) 
评论(0)  编辑  收藏  
			
			
		 
		
		  ec将取得的数据存入request中。但是ec的标签ec:table 中的action属性一般都是定位到当前的jsp。再从当前的request中取数据。如果,action只是定位到自己。ok,导出的xls或pdf只有列名,没有数值。
  解决办法:
        1.在页面的头中添加
 
 1 <%
 2   Object obj=request.getAttribute("persons");
 3   if(obj!=null){
 4    session.setAttribute("persons",(List)obj);
 5   }else{
 6    List list=(List)session.getAttribute("persons");
 7    request.setAttribute("persons",list);
 8   }
 9   List list = (List) request.getAttribute("persons");
10   //System.out.println(list.getClass().getName());
11   session.setAttribute("persons", list);
12 %>
  较为简单,不说了。方法很龌龊。
  2.
    AppTemplate.wc?action=showAttributes
    将ec:table 的属性action定位到查询数据的servlet name。就是让它再查一次。
   鱼与熊掌不可兼得啊!
ok了 ,enjoy it!