I have an issue, model attributes are not retained if any exceptions raised in jsp since they are request scope.
How to resolve the above issue?
As my initial thought, spring will invoke the model attribute methods before controller method gets executed, similarly if i could invoke the model attribute methods as done by spring framework in our
HandlerExceptionResolverImplclass then i think problem will be solved. but could not able figure the way how to do it.
anyone can have similar issue? any suggestions to do this?
Best How To :
Fixed this issue by customizing the
ModelAndViewContainer object into request object since the mavContainer object will have all the model attributes before contoller method getting executed and then in
HandlerExceptionResolverImpl custom class add the below code
ModelAndViewContainer mavContainer = (ModelAndViewContainer) request
if (mavContainer != null)
Hence able to resolve the model attributes upon exceptions.