- 论坛徽章:
- 0
|
public String execute() throws Exception {
if ("admin".equalsIgnoreCase(loginInfo.getUsername())
&& "admin".equals(loginInfo.getPassword())) {
//将当前登录用户名保存到session
ActionContext ctx = ActionContext.getContext();
Map session = ctx.getSession();
session.put("username", loginInfo.getUsername());
return LOGIN_SUCCESS;
}
else
{
loginInfo.setErrorMessage("Username OR Password Error!");
return LOGIN_FAIL;
}
}
此行代码:session.put("username", loginInfo.getUsername());
现在session.put是不是已经不推荐使用了,我还有什么方法存session?
这块
ActionContext ctx = ActionContext.getContext();
Map session = ctx.getSession();
session.put("username", loginInfo.getUsername());
应该怎么写?谢谢! |
|