Results 1 to 4 of 4

Thread: AbstractWizardFormController, bind errors going to previous page

  1. #1
    Join Date
    Nov 2005
    Location
    Chicago, IL
    Posts
    4

    Default AbstractWizardFormController, bind errors going to previous page

    Hi all,
    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?

    Thanks,
    Chris

  2. #2
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default validatePage

    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)

  3. #3
    Join Date
    Nov 2005
    Location
    Chicago, IL
    Posts
    4

    Default

    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

  4. #4
    Join Date
    Sep 2004
    Location
    Arizona, USA
    Posts
    383

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •