1

I have a simple java application. I want to set index.html as my welcome page.

I tried it but its not working. Although index.jsp is working. Is it possible to use 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>
Mind Peace
  • 905
  • 8
  • 29
Parag
  • 369
  • 3
  • 8
  • 28

2 Answers2

1

Update your web.xml

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

You are getting 404 - Page not found because you cannot access files under WEB-INF folder directly

Mind Peace
  • 905
  • 8
  • 29
1

Maybe it is because of the servlet mapping you are doing.

You should change <url-pattern>*.html</url-pattern> to something different so that there is no diffusion.

trikelef
  • 2,192
  • 1
  • 22
  • 39