aspose file tools*
The moose likes Servlets and the fly likes Head First Servlets: Beer Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Head First Servlets: Beer Problem" Watch "Head First Servlets: Beer Problem" New topic
Author

Head First Servlets: Beer Problem

Benjamin Breeg
Greenhorn

Joined: Apr 20, 2007
Posts: 5
greetings,

Im trying our the example given in the Head First Servlets BEER SELECT example .

I have done everything as instructed in the TextBook ! Yet it will not work.

The error it displays is:
------------------------------------------------------------------------
type Status report

message /Beer/Beer.html

description The requested resource (/Beer/beer.html) is not available.

-------------------------------------------------------------------------

and that is just the Form1.html which i call as beer.html .... The webpage is displayed however, if i were to delete the web.xml !!!

can somebody explain this behavior and also help me get this application running successfully ? No beer for me till then
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60975
    
  65

"Sign Of Aries",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Benjamin Breeg
Greenhorn

Joined: Apr 20, 2007
Posts: 5
alrighty then how do i change it ? i changed the publicly displayed name and it still does not work !!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Can you post the directory structure of your webapp.
Also, please post the full path to your webapp on your machine's hard drive.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Benjamin Breeg
Greenhorn

Joined: Apr 20, 2007
Posts: 5
C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Beer:


---------------------------------------------------------------------------

Contents of Web.xml:

<web-app xmlns = "http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2.4.xsd"
version="2.4">

<servlet>
<servlet-name>Ch3Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Ch3Beer</servlet-name>
<url-pattern>SelectBeer.do<url-pattern>
</servlet-mapping>
</web-app>
-------------------------------------------------------------------------

i have followed the book in all regards .. but am wondering what i left out !! even the html page is not getting displayed

[BSouther: Added UBB CODE tags]
[ April 20, 2007: Message edited by: Ben Souther ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Are you sure that Tomcat is running?
What URL did you use when trying to access your app?
Benjamin Breeg
Greenhorn

Joined: Apr 20, 2007
Posts: 5
Tomcat is running and the URL i used is:

http://localhost:8080/Beer/beer.html
Scott Escue
Ranch Hand

Joined: Jan 20, 2005
Posts: 34
Take a look at your Tomcat logs, I believe you may be getting any error when Tomcat tries to start your webapp.

Take a look at your web.xml. The SchemaLocation url in your opening web-app tag is slightly off:
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2.4.xsd"

should be:

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
[ April 20, 2007: Message edited by: Scott Escue ]
Benjamin Breeg
Greenhorn

Joined: Apr 20, 2007
Posts: 5
<url-pattern>SelectBeer.do<url-pattern>

BAD XML !!! i forgot to close the tag
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Head First Servlets: Beer Problem