Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用index.html作为欢迎页面_Java_Jakarta Ee - Fatal编程技术网

Java 使用index.html作为欢迎页面

Java 使用index.html作为欢迎页面,java,jakarta-ee,Java,Jakarta Ee,我有一个简单的java应用程序。我想将index.html设置为我的欢迎页面 我试过了,但不起作用。尽管index.jsp正在工作。 可以使用index.html吗 <display-name>sample</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <ser

我有一个简单的java应用程序。我想将index.html设置为我的欢迎页面

我试过了,但不起作用。尽管index.jsp正在工作。 可以使用index.html吗

<display-name>sample</display-name>
<welcome-file-list>    
  <welcome-file>index.html</welcome-file> 
</welcome-file-list>
<servlet>
    <servlet-name>sample</servlet-name>
    <servlet-class>
        org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>sample</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>
示例
index.html
样品
org.springframework.web.servlet.DispatcherServlet
1.
样品
*.html
更新您的web.xml

<welcome-file-list> 
 <welcome-file>webContent/index.html</welcome-file> 
</welcome-file-list>

webContent/index.html

由于无法直接访问WEB-INF文件夹下的文件,因此无法找到404页。可能是因为您正在进行servlet映射


您应该将
*.html
更改为其他内容,这样就不会出现扩散

非常有可能删除index.html。index.html存储在哪个目录下?它位于我的动态Web项目的webContent文件夹下。当我使用index.html时,我得到了404个错误,我尝试了以下操作,但仍然是相同的错误/