aspose file tools*
The moose likes Servlets and the fly likes multiple welcome files. 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." Watch "multiple welcome files." New topic
Author

multiple welcome files.

Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164
hi,
i have index.jsp in my root directory. to set welcome file i put below mapping in web.xml

its working properly..."http://localhost:8080/usermgmt/"

but now i have a another folder "admin" having index.jsp file. i want to display admin/index.jsp file as a welcome page for admin when i call "http://localhost:8080/usermgmt/admin/"
for that i wrote below mapping...but its not working...



please correct me.
thanks in advance..

milan.
[ January 23, 2007: Message edited by: Milan Jagatiya ]

Milan.<br />I can because I think I can...
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Looks like a Servlet/JSP question, so I am going to move this to a more appropriate forum.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

From the servlet spec:


Note: there are no forward slashes in front of the file names.


I'm guessing that your entry was never working and that you were seeing index.jsp because your container had that listed as one of the default values.
For instances, here is the welcome-file entry in the default web.xml found in Tomcat's conf directory:

[ January 24, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
It should be


no need to put /.as index.jsp would be looked in the directory pointed by your request url.you can have more than one <welcome-file> tag.


Rahul Bhattacharjee
LinkedIn - Blog
Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164
hi,
thanks for your replies, but my problem not matching your answers. what i want is below...

1) i want to set login.jsp as a welcome file for "http://localhost/myapp/".
path for login.jsp is myapp (root directory).
this works by..


2) and index.jsp as a welcomefile for "http://localhost/myapp/admin".
path for index.jsp is myapp/admin/

what should i do for (2) problem???

milan.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

you cannot use welcome files for this. You'll have to use servlets or filters and redirect to the proper file according to the requested path.


[My Blog]
All roads lead to JavaRanch
Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164
thanks Satou,
i was confuseed whether tomcat allows this facility of not....

thanks again.
milan.
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Milan Jagatiya:
hi,
thanks for your replies, but my problem not matching your answers. what i want is below...

1) i want to set login.jsp as a welcome file for "http://localhost/myapp/".
path for login.jsp is myapp (root directory).
this works by..


2) and index.jsp as a welcomefile for "http://localhost/myapp/admin".
path for index.jsp is myapp/admin/

what should i do for (2) problem???

milan.


Do the following



just change in the web.xml according to what I have posted and then you would certainly get your required behaviour.
Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164
thanks rahul,

actually i have tried this but i was forget to deploy my updated war in tomcat. even i was confident about that....but because of old deployment i was confused.....

milan.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: multiple welcome files.