I'm also curious to know what the proper use of isFormChangeRequest() is. I would like to use this to make changes to my form, but isFormChangeRequest() accepts only the request object and returns boolean. This sounds like a good place to check for the request parameter indicating a change, but doesn't seem like the right place to do the actual changes.
It would be nice if SimpleFormController had an empty method processFormChangeRequest called from processFormSubmission that could be overridden by implementing classes to peform the changes.
Code:
...
protected ModelAndView processFormSubmission(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
if (errors.hasErrors()) {
if (logger.isDebugEnabled()) {
logger.debug("Data binding errors: " + errors.getErrorCount());
}
return showForm(request, response, errors);
}
else if (isFormChangeRequest(request)) {
processFormChangeRequest(request, response, command, errors);
return showForm(request, response, errors);
}
else {
logger.debug("No errors -> processing submit");
return onSubmit(request, response, command, errors);
}
}
protected void processFormChangeRequest(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
}
...