Filter调用顺序

Filter的调用顺序按照filter-mapping的在配置中的先后顺序:

当调用下面的每一个servlet都会经过以下3个过滤器,且过滤器有先后顺序

 

	<servlet-mapping>
		<servlet-name>DisplayInputServlet</servlet-name>
		<url-pattern>/servlet/displayInputServlet</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>ResultServlet</servlet-name>
		<url-pattern>/servlet/resultServlet</url-pattern>
	</servlet-mapping>
	
	<filter-mapping>
		<filter-name>SubFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>AddFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>MultiFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

 

你可能感兴趣的:(servlet)