Get your CodeRanch badge!*
The moose likes Servlets and the fly likes page not found error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "page not found error" Watch "page not found error" New topic
Author

page not found error

alwin das
Ranch Hand

Joined: Sep 23, 2005
Posts: 32
hi,
i am trying the code in headfirst java chapter 3
i am stuck on step1:

i have created form.html file and i have put it under tomcat\web-apps\Beer-v1 folder
but after typing http://localhost:8080/Beer-v1\form.html

i get error html page not found.

but if i place the same page under servlet-examples in the webapps folder its working.
http://localhost:8080/servlets-examples/Beer-v1/form.html

or
http://localhost:8080/servlets-examples/form.html


evenif i place Beer-v1 under root folder ,everything is workin fine.
http://localhost:8080/Beer-v1/form.html
my tomcat is running fine .
i am using command prompt for startup and shutdown commands
my tomcat_home is set to c:/tomcat (my installation dir)
catalina_home is set to c:/tomcat

what is going wrong..please help me out.
[ June 25, 2006: Message edited by: alwin das ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by alwin das:
hi,
i have created form.html file and i have put it under tomcat\web-apps\Beer-v1 folder


Two things:

One: It should be "webapps" not "web-apps".
Two: In order for Tomcat to recognize the Beer-v1 folder as a web application, you will need to create, under it, a WEB-INF folder.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
alwin das
Ranch Hand

Joined: Sep 23, 2005
Posts: 32
yes thank you very much.

previously i didnt have WEB-INF folder inside my Beer-v1 folder.

but i dont understnd this ...just to call a html page form.html why we need WEB-INF folder.

because once we click submit then only servlet class and DD will come into picture right?so till that it is just a static html page...so load tht why WEB-INF folder is required?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

In order to be a proper J2EE web app, there must be a WEB-INF directory in the root directory of the application.

Tomcat doesn't just serve up files in directories as a plain web server would.
It deploys separate applications. The presence of the WEB-INF directory is what tells Tomcat that this folder is to be treated as a web application and not just another folder on the file system.
alwin das
Ranch Hand

Joined: Sep 23, 2005
Posts: 32
Thank you very much.That was really of great help.
 
jQuery in Action, 2nd edition
 
subject: page not found error
 
Similar Threads
Tomcat Problem
404 - Page not found ??
form.html not displayed
Tomcat WebApp Deployment
Help -unable to run servlet in APACHE