Brandon Yarbrough
Brandon Yarbrough

Reputation: 38389

Taking an action AFTER rendering a view with Spring MVC

I have a Spring MVC app that uses JSP to render pages. Spring has a built-in concept of Interceptors that go off before and after the controllers are invoked, but the postHandle() call still happens before the actual rendering of the view. I have some cleanup that I want to do AFTER the JSP page completes its rendering. Is there any built-in place I can put that without resorting to adding Tomcat interceptors? I like my nice, contained Spring app.

Upvotes: 0

Views: 1166

Answers (1)

Jose Luis Martin
Jose Luis Martin

Reputation: 10709

use HandlerInterceptor.afterCompletion() that is triggered after view rendering. (but ony if HandlerIntercpetor.preHandle() was sucefully completed and returned true)

Upvotes: 4

Related Questions