aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "welcome file list in web.xml" Watch "welcome file list in web.xml" New topic
Author

welcome file list in web.xml

hhabib rahman
Greenhorn

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

can i include an action in a welcome file list.

for example.
<welcome-file>login.do</welcome-file>
Ben Souther
Sheriff

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
    Hi,

    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.

    Regards
    Alok S kushwah
    rahman habib
    Greenhorn

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

    Joined: Dec 11, 2004
    Posts: 13410

    go to
    http://simple.souther.us
    and look for
    WelcomeFileHack
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: welcome file list in web.xml