File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Giving alias for http://localhots:8080/webapp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Giving alias for http://localhots:8080/webapp" Watch "Giving alias for http://localhots:8080/webapp" New topic

Giving alias for http://localhots:8080/webapp

sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415

I need answer for this req...dont know whether it exists r not

now i have a webapplication in tomcat

and as of now i am accessing that by using http://localhost:8080/webappname

and i have a welcome file for that webapplication as login.jsp

but i need to redirect to my application just by using
http://localhost:8080/ .as soon as the user enters this i want to redirect him to login.jsp

How can i do this ??
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
The default Web site for tomcat is $CATALINA_HOME/webapps/ROOT/.

Approach 1: (Redirect to your web site from the default web site)
In the file $CATALINA_HOME/conf/server.xml, you will find the configuration for the root context. This is how the entry looks, after installing tomcat.

<!-- Tomcat Root Context -->
<Context path="" docBase="ROOT" debug="0"/>

Uncomment the entry, and place an index.html file in $CATALINA_HOME/webapps/ROOT which loads the desired page from your web application.


Approach 2: (Change the default web site)
Add a root context (site) to the contexts near the end of the file $CATALINA_HOME/conf/server.xml:

<Context path="" docBase="/yourWebAppName"
debug="0" reloadable="true" >

You can comment out the old root context (which will no longer be accessible anyway).

NOTE: You will need to update your welcome file list in server.xml to include login.jsp OR rename it to index.jsp.

Hope this helps. (I checked this out for tomcat 4, not sure about other versions)
I agree. Here's the link:
subject: Giving alias for http://localhots:8080/webapp
It's not a secret anymore!