添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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


<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>