String userName = req.getParameter("j_username");
String password = req.getParameter("j_password");
try {
String targetPage = "/pages/index.jsp";
AdministratorService administratorService = (AdministratorService) BusinessUtil
.findBusiness("AdministratorService");
List<Criterion> criterions = new ArrayList<Criterion>();
criterions.add(Restrictions.eq(Administrator.PROPERTY_USERLOGIN,
userName));
criterions.add(Restrictions.eq(Administrator.PROPERTY_USERPASSWORD,
password));
List<Administrator> result = administratorService
.findByParams(criterions);
if (result.size() > 0) {
req.getSession().setAttribute("user", userName);
} else {
targetPage = "/pages/login/login.jsp?error=1";