日期:2014-05-20  浏览次数:20588 次

struts2+spring2,无法用${sessionScope.xxx}获取session中的数据,请指教
求助求助struts2+spring2,运行一切正常,唯一不正常的是我在Action的execute()方法中用session.put("user","xxx");设置了后,去jsp里无法使用${sessionScope.user}取出来
  public String execute() throws Exception {
model = loginMethod.login(model);
Map session = ActionContext.getContext().getSession();
if(model == null){
setTip("密码或者帐号错误");
return ERROR;
}else{
if(model.getRoles().equals("010")){
session.put("user", model.getUserName());
System.out.println(session.get("user"));//该处检测,user已经被正确put
setTip("登陆成功,管理员帐号");
return SUCCESS;
}else{
session.remove("user");
setTip("登陆成功,普通帐号");
return LOGIN;
}
}
  }


------解决方案--------------------
<s:property value="#session.mySessionPropKey"/>