Announcement Announcement Module
No announcement yet.
Converting AbstractFormController to Annotated Controller Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Converting AbstractFormController to Annotated Controller

    I have searched extensively all over the internet and this forum for an answer but I don't seem to be able to find an answer to the following question:

    Does anyone know of a tutorial for how best to convert a subclass of an AbstractFormController to an analogous annotated Controller?

    Before Spring 2.5 was released, I wrote a controller to handle displaying a form, and processing its input. To do this, I extended the AbstractFormController and implemented the showForm, processFormSubmission, and onBind methods. But now that AbstractFormController is deprecated (as of 3.0) I'd like to convert to an annotated controller to do the same thing that AbstractFormController used to do. I'm pretty sure that I have figured out how to do it up to the point of figuring out how to duplicate the functionality of the onBind method. I have annotated the class with the @Controller annotation. I have annotated the showForm method with
    @RequestMapping(method = RequestMethod.GET)
    And I have annotated the processFormSubmission method with
    @RequestMapping(method = RequestMethod.POST)
    However, I cannot seem to find an annotation that would tell the onBind method to be called on the bind event.
    BTW, the full signature of my original onBind method is
    protected void onBind(final HttpServletRequest req, final Object cmd, final BindException errors) throws Exception
    And I know about the @InitBinder annotation but the methods I've seen annotated by it don't appear to have the same signature or function as the onBind method.

  • #2
    Wow. When I first read this recently, I didn't realize I had written this unanswered question. And guess what? Now that I am revisiting this, I STILL have the same problem. On this second go round, I have wasted two more whole fruitless days. Does anybody have an answer? Am I coming at this from the wrong angle?

    Please someone with the knowledge take pity on me and tell me what is intended to replace the onBind callback.