[web basics] about web.xml < welcome file list > in

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

function : specify the home page of the web project (i.e. visit ) http://localhost : 8080/ displayed page)

working principle : Taking the code above as an example, two home pages are set. Then, the system will check whether the file exists in the web directory in order. (that is, first check whether there is a index.html If there is, the file will be displayed; otherwise, check whether it exists index.jsp 。)

supplement :

If the URL pattern of the servlet is /* , then http://localhost : 8080/ does not match welcome file list, but matches the servlet

If the URL pattern is /, the servlet will match welcome file list when it fails to find a suitable match.

Reference

[1] About web.xml CSDN blog

Similar Posts: