为了账号安全,请及时绑定邮箱和手机立即绑定

success.jsp页面进不去了啊 错误500 怎么回事 啊 求大神求大神

三月 02, 2017 8:31:25 下午 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet [jsp] in context with path [/LoginFilter] threw exception

java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to javax.servlet.http.HttpServletResponse

at com.imooc.filter.LoginFilter.doFilter(LoginFilter.java:26)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostVa



代码跟老师的打得  感觉没毛病啊

@Override

public void doFilter(ServletRequest arg0, ServletResponse arg1,

FilterChain chain) throws IOException, ServletException {

       HttpServletRequest request=  (HttpServletRequest)  arg0;

       HttpServletResponse response=  (HttpServletResponse)  arg0;

   HttpSession session = request.getSession();

   

          if( session.getAttribute("username")!=null){

           chain.doFilter(arg0, arg1);

           

          }else {

         response.sendRedirect("login.jsp");

          }

          

       

       

}

HTTP Status 500 - org.apache.catalina.connector.RequestFacade cannot be cast to javax.servlet.http.HttpServletResponse


正在回答

2 回答

<filter>                                                        

<filter-name>CharactorFilter</filter-name>

<filter-class>com.lyq.CharactorFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

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

</init-param>

</filter>

<filter-mapping>

<filter-name>CharactorFilter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>


0 回复 有任何疑惑可以回复我~

你看看是不是在web.xml中过滤器的路径设置的不对,好像跟这个帖子说的类似

http://stackoverflow.com/questions/35381693/severe-servlet-service-for-servlet-package-in-context-with-path-portal-t

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Java Web开发技术应用——过滤器
  • 参与学习       70492    人
  • 解答问题       258    个

本课程主要是从实际生活当中的过滤器入手,详细讲解了Java Web过滤器

进入课程

success.jsp页面进不去了啊 错误500 怎么回事 啊 求大神求大神

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信