Nov 22nd, 2005, 10:24 AM
AbstractWizardFormController, bind errors going to previous page
I don't know if this is a feature or not, but if I am on page two of an N>1 wizard, and that page doesn't have hidden form fields for everything entered on page two, AND I have set up the DataBinder to have lists of required fields, I get binding errors when I go back to page 1 (or page 0, however you look at it).
Is there any way to get around this? like set up a list of required fields on a per-page basis?
Nov 22nd, 2005, 03:09 PM
You could try overriding one of the validatePage methods in AbstractWizardFormController:
protected void validatePage(Object command, Errors errors, int page)
protected void validatePage(Object command, Errors errors, int page, boolean finish)
Nov 22nd, 2005, 03:34 PM
I have already written custom validators for the command object. I've been looking into it a little more and it looks like it's an interaction with the Oracle Server I'm using.
I'm actually using the Spring Portlet MVC here, with Oracle's portlet server. The best that I can tell, somehow, when the ActionRequest is being processed, the _last_ _target# value is somehow in the ActionRequest along with the current _target# value, so the getTargetPage() method gets confused because there are _two_ _target# parameters in the Render phase (passed through via the setTargetRenderParameter() method).
For example, when going back from page 1 to page 0, I have a "Previous" button that has a name of "_target0", but somehow, the request ends up with a "_target1" as well (the parameter used to get to that second page cached somehow?). I double checked my JSPs, and I'm not accidentally including it somewhere.
The only thing I can think of is that for some reason, when I go from page 0 to page 1, "_target1" is passed from the Action phase to the Render phase via the response.setRenderParameter(param, (String)value); call in the setTargetRenderParameter() method. I'm not too familiar with RenderParameters yet, but maybe the Oracle server is embedding it somehow in the ActionRequest
Dec 21st, 2005, 01:05 AM
There's no way around this. This is consistent in both the Servlet and Portlet frameworks. You need to drop your list of required fields and instead check for the required fields in your Validator -- probably using the ValidationUtils.rejectIfEmpty method.