简体   繁体   English

在Tomcat 7上运行Servlet应用程序时遇到错误

[英]Facing error while running my Servlet application on apache tomcat 7

“I have defined welcome file list in servlet program. “我已经在servlet程序中定义了欢迎文件列表。 still my application is not loading the same at the time of startup.what can be the reason? 仍然我的应用程序在启动时没有加载相同的东西。这可能是什么原因? Note that i have put that html file inside web inf folder.” 请注意,我已将该html文件放在web inf文件夹中。”

I have rebuilt and redeploy my application. 我已经重建并重新部署了我的应用程序。 still it doesn't working. 仍然没有用。

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

It should load index.html on startup when i run my web application VoterApp but i am getting resource not available error. 当我运行Web应用程序VoterApp时,它应该在启动时加载index.html,但出现资源不可用错误。

Just try to move your index.html file outside of the WEB-INF folder, in the root directory. 只需尝试将index.html文件移到根目录中的WEB-INF文件夹之外。

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

It should work. 它应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM