String username = obtainUsername(request).trim();
String password = obtainPassword(request).trim();
// System.out.println(">>>>>>>>>>000<<<<<<<<<< username is " +
// username);
if (Common.isEmpty(username) || Common.isEmpty(password)) {
BadCredentialsException exception = new BadCredentialsException(
"用户名或密码不能为空!");// 在界面输出自定义的信息!!
throw exception;
}
// 验证用户账号与密码是否正确
User users = this.userDao.querySingleUser(username);
if (users == null || !users.getUserPassword().equals(password)) {
BadCredentialsException exception = new BadCredentialsException(
"用户名或密码不匹配!");// 在界面输出自定义的信息!!
// request.setAttribute(WebAttributes.AUTHENTICATION_EXCEPTION,
// exception);
throw exception;
}