问题
Our web app contains both index.html and index.jsp, and we use Apache Tomcat 6. When a request having the path till the context (for eg.,http://localhost:8080/mysite) comes to the tomcat which one will be served ?
Is this index.html or index.jsp ?
Is it configurable ?
回答1:
index.html
will be given preference, but you can change this under welcome-file-list
in web.xml
.
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
In the event of a partial request, the above configuration will try index.jsp
, then index.html
, and then index.htm
.
来源:https://stackoverflow.com/questions/2049772/which-one-will-be-given-priority-in-tomcat-6-index-html-or-index-jsp