我有以下web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>cheapig</display-name>
<!--Definição do Contexto Global do Container do Spring com recursos (beans) que são compartilhados com
TODOS os Servlets e Filtros -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Cria o container do Spring compartilhado com todos os Servlets e Filtros -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<display-name>sessionListener</display-name>
<listener-class>br.com.cheapig.util.SessionListener</listener-class>
</listener>
<!-- Filtro para controlar acesso -->
<filter>
<filter-name>cheapigFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>cheapigFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Definição do Servlet que processa todos os requests da aplicação. Como se está utilizando
o Framework Spring, o servlet é o DispatcherServlet. -->
<servlet>
<servlet-name>cheapig</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/cheapig/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Mapeamento dos Servlets e URLs -->
<servlet-mapping>
<servlet-name>cheapig</servlet-name>
<url-pattern>/cheapig/*</url-pattern>
</servlet-mapping>
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/view/util/layout_404.jsp</location>
</error-page>
<error-page>
<error-code>405</error-code>
<location>/WEB-INF/view/util/layout_405.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/WEB-INF/view/util/layout_500.jsp</location>
</error-page>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
然而,当我尝试调用例如:“http:// localhost:9191 / cheapig / urlMappedToAControllerMethod /”时,“urlMappedToAControllerMethod”被调用两次。我想问题是映射,因为,cheapigFilter在转发到“urlMappedToAControllerMethod”之前也会被调用两次。
怎么了?我怎么能解决它?
提前致谢!