Tomcat Hello World

aflat362
aflat362 used Ask the Experts™
on
I would like to direct you to the following question:

http://www.experts-exchange.com/Web/Application_Servers/Q_20720483.html

Please answer it and you get points to both this quesiton and that one.

Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
It looks like there is a typo on your web.xml file. without the web-app you are probably getting an exception and then the tomcat server ignores your file. Can you post the web.xml file you are using, so we can check it?

Author

Commented:
Certianly,

when the web.xml file looks like this:
<?xml version="1.0" standalone='yes'?>

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

The web app starts fine and when I go to http://shoisuow:8080/testing I am directed to my index.html page correctly.
-On a strange note though I had this file configured so the welcome file was index.htm  my file was index.html but it works either way.

When the web.xml file looks 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">

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

The web application will not start.  The error I get is:
FAIL - Application at context path /testing could not be started

When the web.xml file looks like this:
<?xml version="1.0" standalone='yes'?>

<web-app>
<welcome-file-list>
<welcome-file>
index.html
</welcome-file>
</welcome-file-list>
</web-app>

Hmm.  I guess it works fine now (web app starts and I'm directed to index.html)

. . I thought before it didn't - Wait.  before I had web.xml configured with index.htm and not html

I changed the index.html to index.htm (in the xml file) and went to http://shoisuow:8080/testing/
I get a directory listing and not the page.  Very strange.  If you look above you can see that without the web-app tag in the xml doc it doesn't matter if I have index.htm or index.html defined in the web.xml - it just went to my index.html page.

Author

Commented:
Before you unsubscribe to this thread and disappear - I would like to post another question elsewhere that you
will probably be able to help with.  I'll probably post the question later today or tomorrow.  (gotta get back to real work instead of this learning business)

I can now load static HTML pages just fine from my web application but I would like to be able to
run JSP pages next.   I'll post a link to this question when I create the question.  Feel free to leave feedback here if you have ideas already.

Thank you much.

Commented:
Running JSPs is very simple. Put them in the main directory of the war file.
YOu access them by the URL http://shoisuow:8080/testing/myjsp.jsp

Author

Commented:
A war file is something I don't have and don't know how to create.

Right now my web app is a folder called testing with an index.html file in it, and a WEB-INF directory with web.xml in it.
I have a jsp in the same directory as my index.html page that I would like to get to work but it does not.

Believe it or not I am somewhat familiar with java.  (I had a college course a couple of years ago and we did command line style application programming and some stuff with Swing - But not java web programming)

If you could give me a brief explanation of the nature, usage, and creation of a .war file I would be much appreciative.

My concept of a war file is its just a directory with its name ending in .war.  Though I do have suspicions that it is a little different than just a directory as I cannot CD into .war files with some FTP utilities.  Perhaps it uses some kind of ZIP encoding or is "compiled"?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial