Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

welcome file list in web.xml

 
hhabib rahman
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

can i include an action in a welcome file list.

for example.
<welcome-file>login.do</welcome-file>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    Alok Kushwah
    Ranch Hand
    Posts: 31
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 8
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks,
    But its still confusing can you give me example code.
     
    Ben Souther
    Sheriff
    Posts: 13411
    Firefox Browser Redhat VI Editor
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic