Perform this action. Try to log the user in based on the username
and password in the submitted request
// read the username and password from the request
String username = req.getParameter(NAME_PARAM);
String password = req.getParameter(PASSWORD_PARAM);
// get the UserBean from the session
HttpSession session = req.getSession();
UserBean ub = (UserBean) session.getAttribute(USERBEAN_ATTR);
// if the UserBean doesn't exist, create it
if (ub == null) {
ub = UserBeanFactory.newInstance();
session.setAttribute(USERBEAN_ATTR, ub);
}
// set the parameters in the bean
ub.setUsername(username);
ub.setPassword(password);
// try to login
return ub.doLogin();