ActionErrors errors = new ActionErrors();
String username = (String) PropertyUtils.getSimpleProperty(form, "username");
String password = (String) PropertyUtils.getSimpleProperty(form, "password");
if (username.equals(password)) {
ActionMessage error = new ActionError("error.register.sameAsPassword", username);
errors.add("username", error);
}
if (!errors.isEmpty()) {
saveErrors(request, errors);
return mapping.getInputForward();
}
User user = new User();
user.setUsername(username);
user.setPassword(password);
SecurityService service = new SecurityService();
service.add(user);
return mapping.findForward("success");