Can I set Tomcat with a welcome-file in a subfolde

2019-06-06 13:35发布

问题:

Someone at the office threw me this weird-yet-interesting question.

If I have something like this in a web.xml (either app' file or container's file)

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

and the thing has another page in a subfolder that can be used so I change it...

<welcome-file-list>
<welcome-file>subfolder/something.html</welcome-file>
</welcome-file-list>

¿Should the second option work? Thanks!

回答1:

Answering to myself just to let it in the record.

Yes, it can be done. The address bar shows the context URL without the subfolder specified in the welcome-file directive. But it works fine.