我无法覆盖Tomcat的默认欢迎文件列表

时间:2013-02-08 16:16:26

标签: java jsp tomcat tomcat7

我试图覆盖Tomcat(版本7)的默认欢迎文件列表,因为它的conf / web.xml建议通过以下形式声明'welcome-file-list'标记

<welcome-file-list>
        <welcome-file>estore.html</welcome-file>
        <welcome-file>estore.htm</welcome-file>
        <welcome-file>estore.jsp</welcome-file>
</welcome-file-list>

在我的应用程序的web.xml中,但是我收到这样的错误:

  

HTTP状态500 - java.lang.ClassNotFoundException:   org.apache.jsp.estore_jsp

有什么想法吗? 谢谢。

2 个答案:

答案 0 :(得分:2)

我会试试这个:

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>
  1. 在web.xml

  2. 中添加上述代码段
  3. 然后在index.html中,我会使用<link />标记转发到我想要的目标网页,即您的情况下的estore.html。

  4. 这应该这样做。

答案 1 :(得分:0)

Tomcat的默认部署描述符文件位于TOMCAT_HOME / conf / web.xml中,在那里您可以找到标记的默认描述为

<welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

缩进<!-->上面的代码并保存/conf/web.xml文件。现在放置您的代码

 <welcome-file-list>
        <welcome-file>estore.html</welcome-file>
        <welcome-file>estore.htm</welcome-file>
        <welcome-file>estore.jsp</welcome-file>
 </welcome-file-list>

在项目的WEB-INF / web.xml中,然后重新启动tomcat服务器,您将获得结果。

相关问题