|
From: dl <dlu...@iq...> - 2003-11-17 09:54:17
|
This is the method called when a wizard is finished. It
belongs to AbstractWizardFormController. And always starts revalidating
all the pages.
If I have an error on my last page, I get the first page
displayed instead of the right page because the check: if
(errors.getErrorCount() - errors.getGlobalErrorCount() > 0) may be true,
for example when I have custom editors. What is needed here
is to find the right page which indicates errors.
private ModelAndView
validatePagesAndFinish(HttpServletRequest request, HttpServletResponse
response,
Object command,
BindException errors)
throws ServletException, IOException {
for (int page = 0; page < pages.length; page++)
{
validatePage(command, errors, page);
// in case of field errors on a page
-> show the page
if (errors.getErrorCount() -
errors.getGlobalErrorCount() > 0) {
return showPage(request,
errors, page);
}
}
// no field errors -> maybe global errors, or
none at all
return processFinish(request, response, command,
errors);
}
Regards,
Dan
|