loginaction.java.svn-base
来自「struts2结合ext参数传递」· SVN-BASE 代码 · 共 53 行
SVN-BASE
53 行
package com.ufida.struts2.sample;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
// public String login() throws Exception{
// if (getUsername().equals("scott") && getPassword().equals("tiger")) {
//
// ActionContext.getContext().getSession().put("user" , getUsername());
//
// return SUCCESS;
// } else
// return ERROR ;
// }
//
// @Override
// public String execute() throws Exception {
// // TODO Auto-generated method stub
// return null;
// }
public String execute() throws Exception {
if (getUsername().equals("scott") && getPassword().equals("tiger")) {
ActionContext.getContext().getSession().put("user" , getUsername());
return SUCCESS;
} else
return ERROR ;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?