Kaarel Purde
Kaarel Purde

Reputation: 1265

Java webapps - why is index.html displayed when visiting a webapps root directory?

Say you have a webapp named MyWebApp deployed on Tomcat in localhost. If you visit it with your browser like this:

localhost:8080/MyWebApp

then why is the index.html displayed (assuming there is an index.html in the .war file)?

Is there a configuration somewhere that says requests to /MyWebApp should be responded to by sending the index.html? Is it possible to change that configuration? Why isn't there a servlet that handles this request?

Upvotes: 0

Views: 59

Answers (1)

srikanth r
srikanth r

Reputation: 332

The index.html page is specified as welcome page in web.xml file .

Which looks like this:-

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

this is the reason why you see index.html as welcome page.

Upvotes: 2

Related Questions