user.getFullName()),
user.getFullName(), locale),
    public ModelAndView onSubmit(HttpServletRequest request,                                 HttpServletResponse response, Object command,                                 BindException errors)    throws Exception {        if (log.isDebugEnabled()) {            log.debug("entering 'onSubmit' method...");        }        User user = (User) command;        if (request.getParameter("delete") != null) {            mgr.removeUser(user.getUsername());            saveMessage(request, getText("user.deleted", user.getFullName()));            return new ModelAndView(new RedirectView("users.html"));        } else {            if ("true".equals(request.getParameter("encryptPass"))) {                String algorithm =                    (String) getConfiguration().get(Constants.ENC_ALGORITHM);                if (algorithm == null) { // should only happen for test case                    if (log.isDebugEnabled()) {                        log.debug("assuming testcase, setting algorithm to 'SHA'");                    }                    algorithm = "SHA";                }                user.setPassword(StringUtil.encodePassword(user.getPassword(),                                                           algorithm));            }            String[] userRoles = request.getParameterValues("userRoles");            if (userRoles != null) {                // for some reason, Spring seems to hang on to the roles in                // the User object, even though isSessionForm() == false                user.getRoles().clear();                for (int i = 0; i < userRoles.length; i++) {                    String roleName = userRoles[i];                    user.addRole(roleManager.getRole(roleName));                }            }            try {                mgr.saveUser(user);            } catch (UserExistsException e) {                log.warn(e.getMessage());                errors.rejectValue("username", "errors.existing.user",                                   new Object[] {                                       user.getUsername(), user.getEmail()                                   }, "duplicate user");                // redisplay the unencrypted passwords                user.setPassword(user.getConfirmPassword());                return showForm(request, response, errors);            }            if (!StringUtils.equals(request.getParameter("from"), "list")) {                HttpSession session = request.getSession();                session.setAttribute(Constants.USER_KEY, user);                // update the user's remember me cookie if they didn't login                // with a cookie                if ((RequestUtil.getCookie(request, Constants.LOGIN_COOKIE) != null) &&                        (session.getAttribute("cookieLogin") == null)) {                    // delete all user cookies and add a new one                    mgr.removeLoginCookies(user.getUsername());                    String autoLogin =                        mgr.createLoginCookie(user.getUsername());                    RequestUtil.setCookie(response, Constants.LOGIN_COOKIE,                                          autoLogin, request.getContextPath());                }                saveMessage(request, getText("user.saved", user.getFullName()));                // return to main Menu                return new ModelAndView(new RedirectView("mainMenu.html"));            } else {                if (StringUtils.isBlank(request.getParameter("version"))) {                    saveMessage(request,                                getText("user.added", user.getFullName()));                    // Send an account information e-mail                    message.setSubject(getText("signup.email.subject"));                    sendUserMessage(user,                                    getText("newuser.email.message",                                            user.getFullName()),                                    RequestUtil.getAppURL(request));                    return showNewForm(request, response);                } else {                    saveMessage(request,                                getText("user.updated.byAdmin",                                        user.getFullName()));                }            }        }        return showForm(request, response, errors);    }