Configuring welcome files in the DD
You already know that if you type in the name of a web site and you don’t specify a specific file, you (usually) still get something back. Entering http://www.oreilly.com into your browser takes you to the O’Reilly web site, and even though you didn’t name a specific resource (like “home.html”, for example), you still get a default page.
You can configure your server to define a default page for the entire site, but we’re concerned here with default (also known as “welcome”) pages for individual web apps. You configure welcome pages in the DD, and that DD determines what the Container chooses when the client enters a partial URL—a URL that includes a directory, for example, but not a specific resource in the directory.
In other words, what happens if the client request comes in for:
http://www.wickedlysmart.com/foo/bar
Note
“bar” is just a directory
and “bar” is simply a directory, and you don’t have a specific servlet mapped to this URL pattern. What will the client see?
In the DD:
Imagine you have a web app where several different directories have their own default HTML page, named “index.html”. But some directories use a “default.jsp” instead. It would be a huge pain if you had to specify a specific default page or JSP for each directory that needs one. Instead, you specify a list, in order, of the pages you want the Container to look for in whatever ...
Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.