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

multiple welcome files for different uri's

Sree Jag
Ranch Hand

Joined: Oct 14, 2003
Posts: 77
Hi all,
How can we configure web.xml such that there is a <welcome file> for each URI.

ex: if we have http://localhost:8080/webapp then the welcome file should be firstWelcome.jsp
and if we have http://localhost:8080/webapp/admin then the welcome file shoulf be secondWelcome.jsp

Someone please tell me how to do this. If you can show with code, that will be great.


Sree Jag<br />SCJP 1.4
Brahim Bakayoko
Ranch Hand

Joined: Aug 29, 2003
Posts: 155
You can define multiple welcome files, but only one will be used per web application.

So, you will need to create two web applications.

Alternatively, you can create a single welcome file and have it dispatch to other jsps based on the request uri.

SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="" target="_blank" rel="nofollow"></a> down for a while...
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 642
Try putting different index.html or index.jsp in both folders
i.e diff files for webapp folder and diff for admin folder ...hope this helps

All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Sree Jag
Ranch Hand

Joined: Oct 14, 2003
Posts: 77
Hey, thanks both the approaches work. i just wondered whether we can do it in the deployment descriptor.

thanks all,
I agree. Here's the link:
subject: multiple welcome files for different uri's
It's not a secret anymore!