运行 我的 Servlet 应用程序在 apache tomcat 7 上遇到错误

Facing error while running my Servlet application on apache tomcat 7

“我在servlet程序中定义了欢迎文件列表。我的应用程序在 startup.what 时仍未加载相同的原因可能是什么?请注意,我已将 html 文件放入 web inf 文件夹中。”

我已经重建并重新部署了我的应用程序。还是不行。

<?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/j2ee" 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">
  <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  </welcome-file-list>
  <display-name>VoterApp</display-name>
  <servlet>
      <servlet-name>wert</servlet-name>
      <servlet-class>VoterServ</servlet-class>
  </servlet>
  <servlet-mapping>
      <servlet-name>wert</servlet-name>
      <url-pattern>/voterSite</url-pattern>
  </servlet-mapping>
</web-app>

当我 运行 我的网络应用程序 VoterApp 但我收到资源不可用错误时,它应该在启动时加载 index.html。

只需尝试将 index.html 文件移动到根目录中的 WEB-INF 文件夹之外。

rootFolder
 |-- WEB-INF
 |    `-- web.xml
 `-- index.html

应该可以。