struts2-登录后保存到Session中

private Map<String,Object> session;
1.通过ActionContext来获取Session对象
    session = ActionContext.getContext().getSession();
2.将用户名保存Session作用域中去
    session.put("user", name);

你可能感兴趣的:(session,struts2)