GeeCON Prague 2014*
The moose likes Tomcat and the fly likes My Page instead of Welcome Page of Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "My Page instead of Welcome Page of Tomcat" Watch "My Page instead of Welcome Page of Tomcat" New topic
Author

My Page instead of Welcome Page of Tomcat

Abhi Bharade
Greenhorn

Joined: Nov 25, 2004
Posts: 11
I want to disable tomcats index page. And want to display my login.jsp situated in "login" folder.

Please suggest.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5300
    
  13

i think you can achieve this by moving your login-directory to the webapps/ROOT directory

and adding

to the web.xml file in webapps/ROOT/WEB-INF


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Abhi Bharade
Greenhorn

Joined: Nov 25, 2004
Posts: 11
Thanks a lot for the advise.

But isnt there a way in which i dont need to move the directory.

Abhi.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5300
    
  13

i gave it a try but without success, so i don't think so. but maybe another more experienced person knows an answer
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

So what you really want is your web application to be the 'default' application?

If you ask for :

http://www.yourdomain.com/

You'll get Tomcat's homepage. You want *your* application to be there instead?

So make your application the default one ( by configuring it's path attribute to be "", and removing the existing one).

Alternately, if you want to keep your application where it is, then just use HTML tricks to move people along.

Inside of $CATALINA_HOME/ROOT , put an index.html that has nothing but a meta-refresh or javascript refresh to your login page.
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi There,

If you need your page, on calling your application, you need to edit the web.xml file of your application.

Well....first of all, determine whether you have a proper directory structure. Like....c:\Tomcat\YourOwnApp\ is your root directory.

Say, you have a welcome.jsp here. If you want that welcome.jsp to get loaded, when you type http://localhost:8080/YourOwnApp, then, you need to register the name of the file of your choice in the web.xml fine, which would be found in the WEB-INF folder of your application.

The tag is as follows



When the application is loaded, the Tomcat will look for the file, and load it, instead of it's default index.jsp(In case of your files are in ROOT) Or it will list the files, that you have in the current working directory(In case of your having an own application).

Hope this helps you.

Cheers,
Swamy
Abhi Bharade
Greenhorn

Joined: Nov 25, 2004
Posts: 11
Thanx a lot to Roel, Mike and Ramaswamy for your advise.
Abhi Bharade
Greenhorn

Joined: Nov 25, 2004
Posts: 11
Hi!

This is the way i resolved the problem, the way Mike advised.

I changed the path of ROOT context from path="" to path="blah-blah"

placed the login.jsp in my-app root folder.

also changed the path attribute in context of my-app from path="/my-app" to path="".

Made an entry of login.jsp in the welcome listing.

Previously stated by Mike
########################################################################

Alternately, if you want to keep your application where it is, then just use HTML tricks to move people along.
Inside of $CATALINA_HOME/ROOT , put an index.html that has nothing but a meta-refresh or javascript refresh to your login page.

########################################################################

It worked without doing any such thing.

Thanx to all.

Keep Rocking.
Sam Nanda
Greenhorn

Joined: Jan 20, 2005
Posts: 15
Originally posted by Abhi Bharade:
[/QB]
I changed the path of ROOT context from path="" to path="blah-blah"

placed the login.jsp in my-app root folder.

also changed the path attribute in context of my-app from path="/my-app" to path="".

Made an entry of login.jsp in the welcome listing.

[/QB]


Could you be more specific in explaining how & where & in which file did you change the ROOT context path & the path attribute for *your-app* context .... Also did you say you could browse http://localhost:8080 and get into your application. Because thats what I am looking for, I read a couple of forums and nothing was crystal clear about where to , which file to make changes to and how to ??? Correct me if I am wrong, what I tried is:

http://localhost:8080 should get me to my welcome.jsp, which I places into the %CATALINA_HOME%/webapps/ROOT folder and into the WEB-INF/web.xml file of ROOT I placed the following code:

<welcome-file-list>
<welcome-file>welcome.jsp</welcome-file>
</welcome-file-list>

But doing this throws me with an error ....

==================================================================
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
Syntax error, insert "else Statement" to complete IfStatement

Generated servlet error:
Syntax error, insert "}" to complete Block

Generated servlet error:
Syntax error on token "}", delete this token

Generated servlet error:
Syntax error, insert "}" to complete ClassBody
==================================================================

Could anybody help me with this ....

Thanks,
Sam
 
GeeCON Prague 2014
 
subject: My Page instead of Welcome Page of Tomcat