Link to home
Start Free TrialLog in
Avatar of aflat362
aflat362

asked on

Tomcat Hello World

I have experience in ASP and Cold Fusion running on IIS.  However I need to learn JSP and Java web programming.
I downloaded Apache Tomcat/4.1.27 and want to get it up and running for a meaningless test application.

My goal is to make a new web application "Hello World" style.

Tomcat is up and running on my PC and I can get to the default web site at http://MYComputer:8080

I tried making a new web app - Here's what I did:

In the directory C:\Program Files\Apache Group\Tomcat 4.1\webapps I made a new directory called Testing.

In that directory I made index.html and a WEB-INF directory.
In the WEB-INF directory I made a web.xml file (with nothing in it) and a classes and lib folder (with nothing in them)

In the C:\Program Files\Apache Group\Tomcat 4.1\conf directory I edited the file server.xml
to add a new Context tag.  Basically I copied the one from the example applicaiton and pasted it after the </context> tag and then edited it.  So instead of

<Context path="/examples" docBase="examples" debug="0"
                 reloadable="true" crossContext="true">
          <Logger className="org.apache.catalina.logger.FileLogger"
                     prefix="localhost_examples_log." suffix=".txt"
                timestamp="true"/>

In my new context tag I have

<Context path="/Testing" docBase="testing" debug="0"
                 reloadable="true" crossContext="true">
          <Logger className="org.apache.catalina.logger.FileLogger"
                     prefix="localhost_testing_log." suffix=".txt"
                timestamp="true"/>
          <Ejb   name="ejb/EmplRecord" type="Entity"
                 home="com.wombat.empl.EmployeeRecordHome"
               remote="com.wombat.empl.EmployeeRecord"/>

I know that there's a bunch of stuff I'm not using in the new Context tag but I figured it wouldn't matter.

ANYWAY.  What I want to do is get the index.html tag to display when I go to http://MyComputer:8080/Testing

If you could walk me through that - I'm guessing it would be easy - I think that's worth 50 points.
If it turns out that this is actually a more challenging question I'll give you more points for success.

Thank you.
Avatar of aflat362
aflat362

ASKER

"What I want to do is get the index.html tag to display"

You know I meant page - not tag.  Right?
ASKER CERTIFIED SOLUTION
Avatar of vzilka
vzilka

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

I'm starting over with a more simple approach - perhaps you'll offer your help again.

I started off with the default install of Tomcat.

In the directory C:\Program Files\Apache Group\Tomcat 4.1\webapps I made a new directory called testing
In that directory I made index.html as my "hello world" page
also in that directory I created WEB-INF and in WEB-INF I made web.xml

What are the basic requirements to get the index.html doc to display?

I'm guessing that web.xml needs some content besides

<welcome-file-list>
<welcome-file>
index.htm
</welcome-file>
</welcome-file-list>

and that other XML files in the server need to be edited to tell it about my new web app

C:\Program Files\Apache Group\Tomcat 4.1\conf\server.xml

I'm guessing is one of them.  others?

Any help is appreciated.

Thank you


Your web.xml file should look like this:

<?xml version="1.0" standalone='yes'?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems. Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<welcome-file-list>
<welcome-file>
index.htm
</welcome-file>
</welcome-file-list>
</web-app>
The web app wouldn't start when I included the line:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems. Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

In my web.xml

Do you know if there's a typo or something?

Thanks.
Sorry to bother you again.  But. . .

When I use the web-app tag as you instructed above, when I visit

http://shoisuow:8080/testing/

it doesn't automatically route me to my index page.  When I leave the web-app tag out, it does route to the index page automatically.

Please make a post on this thread: https://www.experts-exchange.com/Web/Application_Servers/

And I'll give you some extra points :)  Thanks