Spring mvc simpleformcontroller - how to stop execution when exception thrown?

Up vote 2 down vote favorite share g+ share fb share tw.

I am using simpleformcontroller and get exception thrown in my OnSubmit method. This does not seem to stop the simpleformcontroler process as it redisplays my form. I can see from log4j output that the exception is getting caught and forwarding to my error page as expected.

I can also tell the onSubmit method does not continue after the exception. Which is all good. But I do not see the error page as the simpleformcontroller starts up again and goes through processing for a new form (i can see in log4j ouput Spring log statements 'Displaying New form', 'Creating new command of class ..'.

The normal form page is then displayed again. So the problem is that the exception does not seem to terminate the SimpleFormController, it carries on to display the form again. Anyone help?

Thanks Alan spring-mvc link|improve this question edited May 24 '10 at 6:45skaffman114k8136227 asked May 24 '10 at 3:11alan t111.

– skaffman May 24 '10 at 6:46 SimpleFormController etc are deprecated... consider moving to the annotation-based approach. Download the latest petclinic to see how that works – Hans Westerbeek May 24 '10 at 8:17 This is an existing application on old versions of java so I cant easily go to the annotated approach - unfortunately. – alan t May 24 '10 at 8:36 Immediately after the last log message from the error handling servlet - I get logging from my SFC saying 'Displaying new form'.

Im going to reduce my SFC to the bare minimum and throw an exception in onSubmit and see if that helps me track it down. Thanks for the comments. – alan t May 24 '10 at 8:39 Turned out this was not spring behaviour, but was problem caused by the existing application error page when an exception is thrown on a page in a frameset.

– alan t May 24 '107 at 9:43.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions