This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Author and ninkuma
Marshal
Posts: 66799
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


 
Stefan Wrobel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!