-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Spring MVC Beginner's Guide
By :

As I already mentioned, interceptors are used to intercept actual web requests before or after they are processed. We can relate the interceptor's concept in Spring MVC with the filter concept of servlet programming. In Spring MVC, interceptors are the special classes that must implement the org.springframework.web.servlet.HandlerInterceptor
interface.
The HandlerInterceptor
interface defines three important methods, as follows:
preHandle
: This method gets called just before the web request reaches the controller method to be executed
postHandle
: This method will get called just after the execution of the controller method
afterCompletion
: This method will get called after the completion of the entire web request cycle
Once we have created our own interceptor by implementing the HandlerInterceptor
interface, we need to configure it in our web application context for it to take effect.
Change the font size
Change margin width
Change background colour