views:

330

answers:

1

I would like to write a @RequestMapping style form controller that redirects after a validation error and round-trips the values and error messages into the GET requested form (the Spring docs always just show the view being rendered in directly in response to the POST). Essentially, I think this comes down to putting the BindingResult into the session briefly and then placing it back in the model before the form is rendered.

I can't believe that I am the only person that wants to do this, but I can't find a way that doesn't involve duplicating the whole AnnotationMethodHandlerAdapter. Am I missing an easy solution?

A: 

You have two options:

  • put the messages and model in the session
  • use spring webflow's conversations

(I didn't get the duplication part)

Bozho
Because I wouldn't want to "put the messages and model in the session" within every controller, overriding something in the AnnotationMethodHandlerAdapter or the HandlerMethodInvoker would probably solve the problem, but those two classes don't really lend themselves to being extended.I know Web Flow has some solutions for this, but it seems overkill for simple forms.
Ed Thomas