问答详情
源自:5-3 [Java Web] 过滤器的分类3

请问这句话为什么总是弹出错误,但是我是按照老师的说法写的啊

String charset = config.getInitParameter("charset");

String nofilter = config.getInitParameter("nofilter");

这两句话这里


严重: Servlet.service() for servlet jsp threw exception

java.lang.NullPointerException

at com.kai.FilterFirst.First.doFilter(First.java:32)


<filter>

<display-name>firstfilter</display-name>

<filter-name>firstfilter</filter-name>

<filter-class>com.kai.FilterFirst.First</filter-class>

<init-param>

<param-name>nofilter</param-name>

<param-value>index;fail;/servlet/login</param-value>

</init-param>

<init-param>

<param-name>charset</param-name>

<param-value>UTF-8</param-value>

</init-param>

</filter>


提问者:qq_仔仔_0 2016-08-31 23:19

个回答

  • 肖申克赫本
    2016-09-02 20:13:33

    会不会是<param-value>index;fail;/servlet/login</param-value>中的/servlet/login写错了?应给是个页面而不是路径吧