| Author |
Cannot get Ch3 Example of Head First Servlets to Work
|
Mike Love
Greenhorn
Joined: Sep 16, 2010
Posts: 2
|
|
Hi everyone. This is really frustrating! Id rather just move on with the book but I cant read it without trying to figure out how to get this to work. Everything works fine until I try to add in the servlet portion. When I hit the submit button on the HTML form I get this :
Also, Im running this on windows xp
Here is my web.xml, my html and my java:
And the directory structure for webapp is exactly what the book shows (im kinda winging this diagram below
It seems like I have everything set up correctly. Does anyone see anything I missed? Also, there very well could be some sort of problem with the compilation of BeerSelect.java as Im not sure I have everything configured as far as paths and everything because im a noob at setting this stuff up on my own computer. I was able to get it to compile with no warnings or errors though.... I also am behind 2 routers, I dont know if that would cause a problem though.
Please help! Im supposed to be absorbing as much of the main points of this book as I can for a job interview on tuesday but I cant stand to read it until I can get this example to work!!! =( Thanks everyone
oh and edit: this was the command I used to compile:
from:
C:\Documents and Settings\Brian\Desktop\My Projects\beerV1
javac -classpath "C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar";classes; -d classes "C:\Documents and Settings\Brian\Desktop\My Projects\beerV1\src\com\example\web\BeerSelect.java"
|
 |
Mike Love
Greenhorn
Joined: Sep 16, 2010
Posts: 2
|
|
I tried to redo this all in Netbeans with the same exact files. Once I changed the XML file to look like:
it worked running it from netbeans. Although it was still throwing some errors in the log, I was able to access the html and hit the submit button and have it run the servlet and display my choice. I tried copying that xml file back to my tomcat directory and running the tomcat server again, but I was still getting the same 404 error as mentioned above. So, it looks like the code was all fine (except for possibly the xml?). I have no idea why it doesnt work when trying to start tomcat directly like the book says. Any ideas?
|
 |
Christian Llennoc
Greenhorn
Joined: Feb 15, 2011
Posts: 1
|
|
|
I had the same problem with a 404 but fixed it by renaming Beer-V1 to just beer. Then it worked. Odd.
|
 |
James Finlay
Greenhorn
Joined: Jul 17, 2011
Posts: 1
|
|
Christian Llennoc wrote:I had the same problem with a 404 but fixed it by renaming Beer-V1 to just beer. Then it worked. Odd.
I just did this and it actually works. Anyone know of a reason for this?
Edit: Sorry for bringing up a thread a few months old, but this had been bugging me for a while.
|
 |
 |
|
|
subject: Cannot get Ch3 Example of Head First Servlets to Work
|
|
|