📄 loginaction.java
字号:
package com.action;
import com.LoginCheck;
import com.opensymphony.xwork2.ActionContext;
public class LoginAction {
private String uname;
private String upassword;
//获得uname值
public String getUname() {
return uname;
}
//设置uname值
public void setUname(String uname) {
this.uname = uname;
}
//获得password值
public String getUpassword() {
return upassword;
}
//设置password值
public void setUpassword(String upassword) {
this.upassword = upassword;
}
public String execute() throws Exception {
//new一个LoginCheck对象
LoginCheck lc = new LoginCheck();
//调用业务逻辑组件的判断功能来判断
if(lc.isLogin(getUname(),getUpassword())){
//如果为合法用户,在session范围中添加属性login,其属性值为true,
ActionContext.getContext().getSession().put("login", "true");
return "success";
}else{
return "failure";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -