eclipse - tomcat 主页正在打开,但我所做的任何项目都是 404(在 eclipse helios 中)

标签 eclipse tomcat http-status-code-404

我已经在 J​​SP 中启动了一个项目,我正在使用 eclipse Helios 3.6 和 tomcat 6.0 集成,问题是,当我从 eclipse 启动 tomcat 服务器时,它正常启动(意味着 hompage 显示在“localhost :8085"),但是当我创建一个“新的动态 web 项目”(即使是非常简单的项目,只在“web-content”文件夹中显示 index.html)时,我遇到了 404 not found 错误。 目录结构如下

enter image description here 我正在通过“localhost:8085/testing”访问该项目,但它显示了这样的 404 错误....... enter image description here

我的 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_2_5.xsd" id="WebApp_ID" version="2.5">
       <display-name>testing</display-name>
         <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>

最佳答案

<display-name> 之前添加以下行“web.xml”文件中的标签,那么它可能会帮助你......

   <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
          org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
        </filter-class>
      </filter>
      <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>

关于eclipse - tomcat 主页正在打开,但我所做的任何项目都是 404(在 eclipse helios 中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19161477/

相关文章:

css - Firebug 显示 claro_rtl.css 的 404 错误,但我找不到试图引用该文件的来源

java - 用于生成 CSR 的服务器软件,或者在购买 SSL 证书时我应该在服务器中选择哪个选项?

apache - Tomcat保护文件

java - 如何在类编译后运行java程序

eclipse - Eclipse的hadoop插件未显示在ubuntu上

java - Tomcat 8 类加载 - [WEB-INF/lib] 和 [tomcat/lib] 中 JAR 的区别

php - 登录 magento Ves Bakerop 主题时出现 404 Not Found 错误

vue.js - Vue、vite:GET http://localhost:3000/@vite/client net::ERR_ABORTED 404(未找到)

java - Eclipse PDE : Mimicking IResourceChangeEvents for IJavaProject creation between PDE and developer's workspace?

java - 查找 Eclipse 项目中使用的未使用的 jar