File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes welcome file list in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "welcome file list in web.xml" Watch "welcome file list in web.xml" New topic

welcome file list in web.xml

hhabib rahman

Joined: Apr 03, 2006
Posts: 4
hi all,

can i include an action in a welcome file list.

for example.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Some containers allow it and some don't.

One trick that will almost always get it to work is to:

  • Add the entry to your welcome-file-list, as you already have done.
  • Make sure you have a valid mapping for that entry.
  • Create a blank file with the same name as the entry in your welcome-file-list.

  • This way, when a request comes in, the welcome file mechanism will forward to the file you created but the servlet mapping will cause the request to go to your servlet [action] instead.

    Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
    Alok Kushwah
    Ranch Hand

    Joined: Jul 10, 2007
    Posts: 31

    Another solution to this problem is, create a jsp and put this jsp's url in welcome list. In the jsp redirect the request to your action mapping.

    Alok S kushwah
    rahman habib

    Joined: May 20, 2007
    Posts: 8
    But its still confusing can you give me example code.
    Ben Souther

    Joined: Dec 11, 2004
    Posts: 13410

    go to
    and look for
    I agree. Here's the link:
    subject: welcome file list in web.xml
    It's not a secret anymore!