private Map<String,Object> session;1.通过ActionContext来获取Session对象 session = ActionContext.getContext().getSession();2.将用户名保存Session作用域中去 session.put("user", name); 转载于:https://blog.51cto.com/suyanzhu/1563147