Use of welcome-file-list, why can we specify a list if it would run only one?

352 Views Asked by At

In my JSF application welcome file is set to index.xhtml.

My doubt is, when more than one welcome file is given, which one is run?

If only the first welcome file runs, why do we have <welcome-file-list> which allows multiple welcome files?

1

There are 1 best solutions below

0
On

Because a "welcome file" is not a "homepage file" as many starters misinterpret them. A "welcome file" is the default file which should be served up when any folder is requested. This not only includes the root ("home page") folder http://example.com/context/, but also all subfolders like http://example.com/context/foo/, http://example.com/context/foo/bar/, etc.

Those subfolders may have differently named "startup" files. That's exactly why you can specify multiple of them.

Do note that this is not JSF specific. The web.xml is part of Servlet API, not JSF API.

See also: