导入spring-web.jar spring-beans.jar spring-core.jar
<filter>
<filter-name>OncePerRequestFilter</filter-name>
<filter-class>filter.TestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OncePerRequestFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
package filter;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.filter.OncePerRequestFilter;
public class TestFilter extends OncePerRequestFilter
{
public void doFilterInternal(HttpServletRequest request,HttpServletResponse response,FilterChain chain)
throws ServletException,IOException
{
System.out.println("begin");
chain.doFilter(request, response);
System.out.println("end");
}
}
2 个解决方案
#1
快掉到第2页了。。顶起。。
#2
靠。。难道真的没人用过么??
#1
快掉到第2页了。。顶起。。
#2
靠。。难道真的没人用过么??