Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiple welcome files for different uri's

 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,
Seshu
 
Brahim Bakayoko
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Cheers
Praful
 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, thanks both the approaches work. i just wondered whether we can do it in the deployment descriptor.

thanks all,
Seshu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic