("request".equals(mapping.getScope))
request.removeAttribute(mapping.getAttribute);
session.removeAttribute(mapping.getAttribute);
}
// Forward control to the specied success URI
(mapping.findForward("success"));
}
/**
* Look up the user, throwing an exception to simulate business logic
* rule exceptions.
*
* @param database Database in which to look up the user
* @param username Username specied on the logon form
*
* @exception ModuleException a business logic rule is violated
*/
public User getUser(UserDatabase database, String username)
throws ModuleException {
// Force an ArithmeticException which can be handled explicitly
("arithmetic".equals(username)) {
throw ArithmeticException;
}
// Force an application-specic exception which can be handled
("expired".equals(username)) {
throw ExpiredPasswordException(username);
}
// Look up and the specied user
((User) database.findUser(username));
}
}
最新评论