4.Struts的<action input=""></action>:业务逻辑层

来源:互联网 发布:java判断请求的浏览器 编辑:程序博客网 时间:2024/05/20 16:51
package com.bjpowernode.struts;public class UserManager {public void login(String username, String password) {if (!"admin".equals(username)) {throw new UserNotFoundException();}if (!"admin".equals(password)) {throw new PasswordErrorException();}}}

package com.bjpowernode.struts;public class UserNotFoundException extends RuntimeException {public UserNotFoundException() {// TODO Auto-generated constructor stub}public UserNotFoundException(String message) {super(message);// TODO Auto-generated constructor stub}public UserNotFoundException(Throwable cause) {super(cause);// TODO Auto-generated constructor stub}public UserNotFoundException(String message, Throwable cause) {super(message, cause);// TODO Auto-generated constructor stub}}

package com.bjpowernode.struts;public class PasswordErrorException extends RuntimeException {public PasswordErrorException() {// TODO Auto-generated constructor stub}public PasswordErrorException(String message) {super(message);// TODO Auto-generated constructor stub}public PasswordErrorException(Throwable cause) {super(cause);// TODO Auto-generated constructor stub}public PasswordErrorException(String message, Throwable cause) {super(message, cause);// TODO Auto-generated constructor stub}}