O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

image with no caption

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required