当前位置: 代码迷 >> Java Web开发 >> 新建web项目之后,打开index.jsp也报404异常,是web.xml的有关问题同学都没有遇到过求大神帮忙找下异常
  详细解决方案

新建web项目之后,打开index.jsp也报404异常,是web.xml的有关问题同学都没有遇到过求大神帮忙找下异常

热度:67   发布时间:2016-04-13 22:23:22.0
新建web项目之后,打开index.jsp也报404错误,是web.xml的问题同学都没有遇到过求大神帮忙找下错误
我发现是web.xml的问题,这是我web.xml的代码
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>text</display-name>
  
  <filter>
<!-- 指定Filter的名字,不能为空 -->
   <filter-name>struts2</filter-name>
   <!-- 指定Filter的实现类,此处使用的是Struts2提供的拦截器类 -->
   <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
 </filter>
 <filter-mapping>
   <!-- Filter的名字,该名字必须是filter元素中已声明过的过滤器名字 -->
   <filter-name>struts2</filter-name>
   <!-- 定义Filter负责拦截的URL地址 -->
  <url-pattern>/*</url-pattern>
 </filter-mapping>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>
------解决思路----------------------
您访问的时候带项目名。了吗/ 
一般情况下都要带
------解决思路----------------------
不定义 servlet 么?
------解决思路----------------------
工程需要发布才能访问
------解决思路----------------------
404没有找到啊,应该是没有发布成功,你看看tomcat服务器webapps目录下有没有你发布的项目文件夹
  相关解决方案