📄 exceptionaction.java.svn-base
字号:
package com.test.actions;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.test.exception.PassWordException;
import com.test.exception.UserNameException;
@SuppressWarnings("serial")
public class ExceptionAction 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;
}
@Override
public String execute() throws Exception {
// 检查用户名
if (! "Panda逍遥".equals(this.getUserName())) {
throw new UserNameException("用户名错误!!");
// 检查密码
} else if (! "systemtao".equals(this.getPassword())) {
throw new PassWordException("密码错误!!");
} else {
return Action.SUCCESS;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -