web项目部署在tomcat后不能访问jsp页面,可以访问html页面解决思路

web项目部署在tomcat后不能访问jsp页面,可以访问html页面
web项目部署在tomcat后不能访问jsp页面,可以访问html页面

tomcat应该算是正常启动,启动日志如下:web项目部署在tomcat后不能访问jsp页面,可以访问html页面解决思路


求大神帮忙看看,纠结好久了。
------解决思路----------------------
1. http://127.0.0.1:8989 页面能看到小猫吗?
2. 你怎么部署的?改的 server.xml 还是直接丢的 war 包?如果是前者,贴配置;如果是后者,注意 war 包名是不是 gdzc.war?
------解决思路----------------------
工程目录发出来下,WEB-INF下的是不能直接访问的。
------解决思路----------------------
在你的filter应该把login.jsp这个文件去除掉,因为这个文件不需要过滤
<filter>
<filter-name>LoginFilter</filter-name>
<filter-class>filter.LoginFilter</filter-class>
<init-param>
<description>
</description>
<param-name>excepUrl</param-name>
<param-value>/login.jsp</param-value>
</init-param>
</filter>


对应的你的filter就应该这样写
public class LoginFilter extends HttpServlet implements Filter {
/**
 * 
 */
private static final long serialVersionUID = 3441961266017874098L;
private String excepUrl;

public void init(FilterConfig arg0) throws ServletException {
excepUrl = arg0.getInitParameter("excepUrl");
}

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) throws IOException, ServletException {

HttpServletRequest arg0 = (HttpServletRequest) request;
HttpServletResponse arg1 = (HttpServletResponse) response;

String servletPath = arg0.getServletPath();
if (servletPath.equals(excepUrl)) {
filterChain.doFilter(request, response);
return;
}

Object user = arg0.getSession().getAttribute("loginUser");
if (user == null) {
arg0.getSession().setAttribute("msg", "请先登录");
arg1.sendRedirect(arg0.getContextPath() + "/login.jsp"); // 返回登录界面
return;
}
filterChain.doFilter(request, response);

}

}