-
Jun 6th, 2012, 09:24 PM
#1
ModelAttribute on exception handlers
I am new to spring MVC. So, sorry if I am saying something that does not make any sense.
I would like to get the modelAttribute(my form object) in my exceptions handlers, is that possible?
So, I could be able to send the previous form data to the JSP that is handling the exception.
I read the spring MVC exception handler documentation, and it seemed not possible.
So what you masters of Spring can tell me ?
Is there any easy and not so forced way to do that?
Spring framework is normally flexible and extensible. But the exception handler life cycle in Spring MVC has being a little bit hard to work with, at least for me
.
Last edited by rafaelweingartner; Jun 6th, 2012 at 09:28 PM.
-
Jun 7th, 2012, 01:17 AM
#2
Well it depends... If you use an annotated method as an exception handler then you can (@ExceptionHandler) but if you use the HandlerExceptionResolver interface you cannot. The exception handling mechanism is broader then just controllers and as such it has to cover the common cases and not every handler knows or has a model and as such that isn't available, next to that the error could occur even before the model would be constructed or would be there.
However it doesn't mean the data isn't there, it still is http and as such everything is available as either request parameters or in the session (if you use @SessionAttributes).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules