Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My Page instead of Welcome Page of Tomcat

 
Abhi Bharade
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to disable tomcats index page. And want to display my login.jsp situated in "login" folder.

Please suggest.
 
Roel De Nijs
Sheriff
Posts: 10213
129
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Abhi Bharade
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for the advise.

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

Abhi.
 
Roel De Nijs
Sheriff
Posts: 10213
129
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx a lot to Roel, Mike and Ramaswamy for your advise.
 
Abhi Bharade
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic