Form form = formsSupport.getForm(request, path);
if (form == null) {
throw new ServletException("Cannot find form for action '" + path);
}
FormInputValues formParams = new RequestInputValues(request);
FormResult result = form.validate(request, formParams);
request.setAttribute(FormsSupport.FORM_RESULT_KEY, result);
if (result.isValid()) {
log.debug("valid: yes");
FormProperties properties = formsSupport.getFormProperties(request, path);
if (properties != null && commit) {
properties.commit();
}
return command.execute(request, response);
} else {
log.debug("valid: no");
messageSupport.setErrors(request, result.getMessages());
return dispatch;
}
}