File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Problems with the Example from HF Servlets & JSP in Chapter 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problems with the Example from HF Servlets & JSP in Chapter 3" Watch "Problems with the Example from HF Servlets & JSP in Chapter 3" New topic
Author

Problems with the Example from HF Servlets & JSP in Chapter 3

Stefan Wrobel
Greenhorn

Joined: Apr 02, 2010
Posts: 3
Hi all,

im reading the Head First Servlets & JSP book and I have problems with the Beer-App in Chapter 3.

First, I followed the instructions until page 77. When I tried to open
http://localhost:8080/Beer-v1/form.html
I got an error:


After I created an new directory in the webapps-directory and moved the Beer-v1 directory into it, the form.html worked (now using http://localhost:8080/scwcd/Beer-v1/form.html).

But now (being at the bottom of page 81), if I click on the submit-button, I get:


I already read some threads in this forum about the same example, but I actually couldn't find any solution that worked for me.

I have created the following files/dirs:
/var/lib/tomcat6/webapps/scwcd/Beer-v1/form.html
/var/lib/tomcat6/webapps/scwcd/Beer-v1/WEB-INF/
/var/lib/tomcat6/webapps/scwcd/Beer-v1/WEB-INF/web.xml
/var/lib/tomcat6/webapps/scwcd/Beer-v1/WEB-INF/lib/
/var/lib/tomcat6/webapps/scwcd/Beer-v1/WEB-INF/classes/
/var/lib/tomcat6/webapps/scwcd/Beer-v1/WEB-INF/classes/com/
/var/lib/tomcat6/webapps/scwcd/Beer-v1/WEB-INF/classes/com/example/
/var/lib/tomcat6/webapps/scwcd/Beer-v1/WEB-INF/classes/com/example/web/
/var/lib/tomcat6/webapps/scwcd/Beer-v1/WEB-INF/classes/com/example/web/BeerSelect.class

form.html:


web.xml:



BeerSelect.java (in my developement directory!):


I would be really glad I someone could help me

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

What's with the scwcd folder?

If you want the context path to be Beer-v1, that folder must reside in webapps. Sticking extra folders in the middle only boofs things up.



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Wrobel
Greenhorn

Joined: Apr 02, 2010
Posts: 3
Thanks, it works now, after moving the Beer-v1 folder out of the scwd-folder and - correcting the mistake on line 10 in my web.xml.
 
 
subject: Problems with the Example from HF Servlets & JSP in Chapter 3
 
Similar Threads
Servlet Doesn't appear to be working.
Cannot get Ch3 Example of Head First Servlets to Work
error for first web application : The requested resource (/Beer-v1/SelectBeer.do) is not available.
Problem: requested resource not available
Cannot bring up a html page using tomcat 6.0