mvc:interceptorsThis tag is used to register a custom interceptor or a webrequestinterceptors.
You can use the URL to define the path request interception, can achieve finer granularity interception control.
For example, in configuration file join
<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:mvc= "Http://www.springframework.org/schema/mvc"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/ Spring-beans-3.0.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/ Spring-mvc-3.0.xsd "><!--The following configuration will intercept all URL requests -<mvc:interceptors><Beanclass= "Org.springframework.web.servlet.i18n.LocaleChangeInterceptor" /></mvc:interceptors><!--The following configuration will intercept the unique URL request -<mvc:interceptors><Mvc:interceptor><mvc:mappingPath= "/secure/*"/><Beanclass= "Org.example.SecurityInterceptor" /></Mvc:interceptor><Mvc:interceptor><mvc:mappingPath= "/admin/*.do"/><Beanclass= "Org.example.admin.ControlInterceptor" /></Mvc:interceptor></mvc:interceptors></Beans>
The interceptor defined only needs to be implemented
@Override
public boolean prehandle (HttpServletRequest req,httpservletresponse res, Object handler)
Mvc:interceptors tag Configuration Interceptor in Spring3