java.lang.ClassNotFoundException: com.itheima.web.filter.MyFilter为什么找不到配置文件没有问题啊? 40
<filter><filter-name>myFilter</filter-name><filter-class>com.itheima.web.filter.MyFil...
<filter>
<filter-name>myFilter</filter-name>
<filter-class>com.itheima.web.filter.MyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>myFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
public class MyFilter implements Filter {
public void destroy() {}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
chain.doFilter(request, response);
HttpServletRequest req=(HttpServletRequest) request;
req=new MyRequest(req); //把HttpServletRequest包装成MyRequest
chain.doFilter(req,response);
}
public void init(FilterConfig fConfig) throws ServletException {} } 展开
<filter-name>myFilter</filter-name>
<filter-class>com.itheima.web.filter.MyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>myFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
public class MyFilter implements Filter {
public void destroy() {}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
chain.doFilter(request, response);
HttpServletRequest req=(HttpServletRequest) request;
req=new MyRequest(req); //把HttpServletRequest包装成MyRequest
chain.doFilter(req,response);
}
public void init(FilterConfig fConfig) throws ServletException {} } 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询