aspose file tools*
The moose likes Tomcat and the fly likes setting index.html to my context root Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "setting index.html to my context root" Watch "setting index.html to my context root" New topic
Author

setting index.html to my context root

Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
hi all,
Im using tomcat 4.0.. My context root is "raj"
wat i want is when i enter the url
http://localhost:8080/index.html
i want the to invloke the login.jsp file inside the ..webapps/raj directory
by default
http://localhost:8080/index.html
will go to webapps/root/index.html right ?
can any1 guide me ?

thanks,
raj


SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

With just Tomcat stand-alone, you'd need to replace the root context.

Currently, you have an entry like this...
<Context path="" docBase="ROOT" debug="0"/>

You'd need to make it:
<Context path="" docBase="raj" debug="0"/>

So that any requests for "" as a context are routed to your raj context.

Regarding index.html
I'd put nothing but a single META tag in this page, and it would redirect the browser to login.jsp

But what if they just type:
http://localhost:8080/
(without the index.html)

You'd need to use the welcome-file list in web.xml. Your one entry could be login.jsp
Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
thanks Mike..
this is wat i was looking for....
Thanks,
raj
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61429
    
  67

Another technique would be to have your index.html simply redirect to the appropriate location.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
hi bear,
could u tell me how redirect is done in html page ?? if it is a jsp, then only we can use the redirect method right ??
Thanks,
raj
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61429
    
  67

Well, you could do it with a JSP scriptlet in a JSP (by adding index.jsp to your welcome file list), but in pure HTML I was thinking along the lines of the meta tag:

The 0 indicates the time (in seconds) to delay before the redirect (in this case, none).
hth,
bear
[ April 25, 2003: Message edited by: Bear Bibeault ]
 
 
subject: setting index.html to my context root