在xwork2.1.6版本中使用以下这段代码是没有错误的。 ActionContext ctx = ActionContext.getContext(); Map session = ctx.getSession(); session.put(String, Object); 但在xwork2.0.7版本中就会出现null错误;解决的方法: Map session = new HashMap(); ActionContext.getContext().setSession(session); session.put(String, Object);