永发信息网

关于java过滤器的问题

答案:2  悬赏:70  手机版
解决时间 2021-07-31 09:38
  • 提问者网友:世勋超人
  • 2021-07-30 22:36

应该是Web.XML的问题我把下面的那段东东加上去他就报错,运行页面就报404错误

<filter>
<filter-name>CheckFilter</filter-name>
<filter-class>ch02.filter.CheckFilter</filter-class>
<init-param>
<param-name>first</param-name>
<param-value>8</param-value>
</init-param>
<init-param>
<param-name>last</param-name>
<param-value>20</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CheckFilter</filter-name>
<url-pattern>/y2144/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

错误:2009-10-21 19:49:53 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2009-10-21 19:49:53 org.apache.catalina.core.StandardContext start
严重: Context [/restrant] startup failed due to previous errors
2009-10-21 19:49:53 org.apache.coyote.http11.Http11Protocol start

当我把他删掉之后,一切正常。请高手帮忙,这是为什么?,怎么解决?

最佳答案
  • 五星知识达人网友:北城痞子
  • 2021-07-30 23:12

问陈名喜就好了!


<filter>
<filter-name>CheckFilter</filter-name>
<filter-class>ch02.filter.CheckFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CheckFilter</filter-name>
<url-pattern>/y2144/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

全部回答
  • 1楼网友:蕴藏春秋
  • 2021-07-30 23:43
试一下改为这样: <filter> <filter-name>CheckFilter</filter-name> <filter-class>ch02.filter.CheckFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>CheckFilter</filter-name> <url-pattern>/y2144/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping>
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯