日期:2014-05-18  浏览次数:20662 次

struts2中ActionContext.getContext()获取为null,求好心人
网上查了下资料,说ActionContext.getContext()在构造方法中会获取null,但我是写在方法中的,不知道为什么,求好心人棒棒忙,以下是方法中的代码
public String list() throws Exception{
List<Depot> list=dao.findAll();
if(list!=null){
for(int i=0;i<list.size();i++){
System.out.println(list.get(i).getDepotName());
}
ActionContext context=ActionContext.getContext();
System.out.println(context);
context.put("list", list);
return "list";
}else{
return ERROR;
}
}

------解决方案--------------------
监听器用的是那个?
------解决方案--------------------
把你的web.xml的内容贴出来,看一下