Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

welcome-file-list in web.xml  RSS feed

 
Jack Lau
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

What is the purpose of <welcome-file-list> tag in web.xml? Why we can add more than one welcome file inside the tag? I tried that it will automatically redirect to /jsp/index.jsp when type the domain + webapp name in url address, if /jsp/index.jsp in <welcome-file> tag. But why it allows multiple welcome files? (It can redirect to different welcome file?)

Thanks in advance!
Jack
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is something from the servlet 2.4 specification.


� The deployment descriptor lists the following welcome files.
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>

� The static content in the WAR is as follows
/foo/index.html
/foo/default.jsp
/foo/orderform.html
/foo/home.gif
/catalog/default.jsp
/catalog/products/shop.jsp
/catalog/products/register.jsp

� A request URI of /foo will be redirected to a URI of /foo/.

� A request URI of /foo/ will be returned as /foo/index.html.

� A request URI of /catalog will be redirected to a URI of /catalog/.

� A request URI of /catalog/ will be returned as /catalog/default.jsp.

� A request URI of /catalog/index.html will cause a 404 not found

� A request URI of /catalog/products will be redirected to a URI of /
catalog/products/.

� A request URI of /catalog/products/ will be passed to the �default� servlet, if any. If no �default� servlet is mapped, the request may cause a 404 not Web Application Environment 77 found, may cause a directory listing including shop.jsp and register.jsp, or may cause other behavior defined by the container. See Section SRV.11.2, �Specification of Mappings� for the definition of �default� servlet.
 
Jack Lau
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a page index.html in /pages and I tried /pages/ but it does not redirect to /pages/index.html, it just list out all the files.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!