日期:2014-05-19  浏览次数:20690 次

struts2 Action返回List返回空...
Java code

private List<ForumPageVo> fList;
    
    @Resource
    private ForumService forumService;
    
    private Page page;
    private Integer pageNo;
    private String pageNoStr;
    
    private Integer f;
    
    
    public String SerachById(){
        
        page = new Page(50, ForumPageVo.class);

        if (!"".equals(pageNoStr) && pageNoStr != null) {
            pageNo = Integer.parseInt(pageNoStr);
        }
        page.setPageNo(pageNo);
        page = forumService.findPageBySql(page, forumService.FORUM_BY_ID_SQL, f);
        fList = page.getResult();
        
        return "success";
    }


fList在return之前里面是有值得...我的debug看过了...
但是到了页面就显示为null

我另外有一个类也是一样的代码但是可以返回List数据...这个类的就不行...不知道为什么...

也不报错误...

我不明白是为什么这个类的其他的如PageNo等是返回正常的...

但是只有List不返回数据...调了半天没搞明白...求帮助啊.


------解决方案--------------------
将List存入request中
------解决方案--------------------
问一下,你有对fList做geter和seter吗。。。。。。。。。。。。。。。。。。