RSS Feed
15
Oct.
2003

JBoss, Jetty, welcome-file and index.do

Unfortunately it is a little bit tricky to get the default welcome file index.do working with Struts and Jetty. Suppose you have th following web.xml:

...
<welcome-file-list>
  <welcome-file>index.do</welcome-file>
</welcome-file-list>
...
and you have configured the ActionServlet to listen on *.do requests. Then you would assume that
http://some.url.com/index.do
would work? Right? No! I guess the problem is that the default servlet (which handles the welcome-file stuff) looks for the file index.do on the filesystem. Unless there is no such file the ActionSerlvet will never be called.
The trick is to simply add an empty index.do file in the root directory of your WAR. That's it =)

Comments

1. Crofton
My solution is still using index.jsp or index.htm as the welcome page, but index.jsp or index.htm do nothing but redirect the page to index.do. You can use javascript's refresh() or jsp's sendRedirect() to implement it.

2. WoEyE
Indeed I tried to find out if there is a solution which requires no file at all but I guess this cannot be done because of architectural issues ...

3. Joseph Ottinger
I detailed this kind of solution at http://java.enigmastation.com/Q250 ; note that the next servlet spec's revision supposedly changes this to allow resources as welcome-files.

4. WoEyE
Thanks for this info, Joseph!