This week's book giveaway is in the Android forum.
We're giving away four copies of Learning Java by Building Android Games and have Jean-Marcel Belmont on-line!
See this thread for details.
Win a copy of Learning Java by Building Android Games this week in the Android 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Head First BeerSelect problems  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello this is my first post so if I mess up please correct me; I am here to learn. A little back story I am a student. I have passed XHTML with css (Head First book) but my Java is very limited, one class using the alice software
and the current semester we are using the Head First Java and the Head First Servlet/JSP books simultaneously and all our work has been done in either Eclipse or Netbeans and we installed Tomcat 7.0 and jdk7
when I point the browser(not the internal eclipse one) at localhost:8080/Beer-v1form.html when I click the submit I get a 404 The requested resource (/Beer-v1/SelectBeer.do) is not available. before I posted I went through your classpath and moosegreeting tutorials I got it to compile and run. I should note that I tried to run my program with all the files just in eclipse but it couldn't find anything so I built the file structure in tomcat the book says and copied the files to there now I get the the previously mentioned 404. I feel more comfortable with Eclipse and have never used command line for much but I am willing to learn the right way to do this I get the impression that what the instructor is having us do is not a best practice














apache logfile
I found it but I don't know which log would help
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

First of all, you should be accessing the application using http://localhost:8080/[context-path]/SelectBeer.do and secondly the package mentioned in the web.xml does not match the package defined in the BeerSelect.java.





 
robert dodson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Piyush Mangal thank you for your input I see the package problem and have taken a closer look at the directions in the text I made these changes(code below) I made separate packages for BeerSelect and BeerExpert to match what the book says. I am confused about the access statement you made I thought I understood the Head First book to say I use http://localhost:8080/beer-v1/form.html and when you click submit, the BeerSelect servlet is called and passed the user selection and then it calls the BeerExpert which returns the results which are passed to the jsp to make the reply with the results is that not right?







 
Piyush Mangal
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could you please let me know where is your form.html located in war and what is the context-path? As for access statement, normally htmls and jsps are stored in WEB-INF folder so that they can be protected from direct access, I guess that is not the case here.
 
robert dodson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my file structure I have seen a few references to a war but I don't know what that is.

just to be thorough here are my environmental variables

PATH C:\Program Files\Java\jdk1.7.0_03\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\

JAVA_HOME C:\Program Files\Java\jdk1.7.0_03

CLASSPATH C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin

I am not sure CLASSPATH is right
 
Piyush Mangal
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folder structure looks fine to me. You don't need to set the CLASSPATH variable.
Did you recompile the BeerSelect.java after changing the package declaration?
What is the output when you access http://localhost:8080/Beer-v1/SelectBeer.do directly?
 
robert dodson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WOOO HOOOO its working I changed the packages and recompiled and restarted tomcat and it all works. I did try to go to http://localhost:8080/Beer-v1/SelectBeer.do directly like you asked and I got HTTP method GET is not supported by this URL but the Beer-v1/form.html serves up the right pages and when you submit the jsp serves up the answer thank you for your help
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!