File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Running JSP on TomCat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Running JSP on TomCat" Watch "Running JSP on TomCat" New topic

Running JSP on TomCat

Gayathri Neti

Joined: Mar 08, 2002
Posts: 25
I am new to this. I am running TomCat4.1.18 version. I am trying to run a sample JSP.
I created a folder called "inc" in e:/jakarta-tomcat-4.1.18/webapps/inc. I have included "index.jsp" in this folder.
In folder e:/jakarta-tomcat-4.1.18/conf/server.xml file, I have added
<Context path="/inc" docBase="inc" debug="1" reloadable="true"/>
I restatred the server and
When I execute http://localhost:8080/inc/index.jsp,
I get "HTTP:404" server error.

Thank You.
matt hooker
Ranch Hand

Joined: Jul 26, 2001
Posts: 46
sounds like you need a webapp context.
Under the Tomcat <dir> there is a sub dir called webapps. In here you will find a couple of webapps already.
I would recommend following their structure :0
ie :- Tomcat 4.1/webapps/<your_webapp>/..put your jsp here, and ALSO
Tomcat 4.1/webapps/<your_webapp>/WEB-INF/web.xml
i think you need this webapp context descriptor file.
Haven't used Tomcat for a while tho ....

Its not what you do, its the way you say you've done it.
Gayathri Neti

Joined: Mar 08, 2002
Posts: 25
My code is pretty simple. When I execute http://localhost:8080/examples/jsp/num/numbguess.jsp, I am able to see the webpage.
Now, I have a sample JSP "index.jsp" in "jakarta-tomcat-4.1.18/webapps/inc/. I have modified the server.xml file with
<Context path="/inc" docBase="inc" debug="0"
reloadable="true" crossContext="true"/>
<style>p { font-family:tahoma; font-size:14pt; }</style>
String name = "World";
<p>Hello <%= name %>!</p>

I know I am missing some part of configuration. But I am unable to figure it out....

Gopi Balaji
Ranch Hand

Joined: Jan 23, 2003
Posts: 84
Tomcat is sensitive about case. If you have named your file INDEX.JSP, try http://localhost:8080/inc/INDEX.JSP
It is sorta covered in the JavaRanch Style Guide.
subject: Running JSP on TomCat
It's not a secret anymore!