This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Ok, so I'm trying to figure out all of this servlet stuff. Here is what I did:
First, using one of the WORKING examples from apache tomcat 6, I took this:
copied it and changed the class name to blabla, so now the line that said:
and yes, I did name the file blabla.java and i didn't get compiler err.
I compiled the program and moved the blabla.class file to the same folder that the HelloWorldExample.class file was located. I then added the following lines of code to the web.xml file located in the webapps/examples/WEB-INF folder:
The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).
I have read up, and it seems this is a common error which usually occurs because people don't override the super class doGet method provided by the HttpServlet class, but if you look at my code, I obviously do that.
So to recap, I copied WORKING HelloWorldExample servlet and renamed HelloWorldExample to blabla in the java file. I then compiled it and moved blabla.class to the same location as HelloWorldExample.class. I then added to web.xml to configure url mapping.
Was there something else that I missed? Is there something obvious that my frustration is blinding me from? Thanks in advance for the help.
The first thing to do, in order to eliminate it as a possible source of error, is to move your class to a package other than the default.
Yeah, the other class appears to be working, but it's a poor practice and can lead to issues. Let's eliminate it a source of issues and move on if the problem persists. (As well as just getting into a good habit.)
I didn't really fix this per say. I made a new dynamic web project on eclipse and used the defaults from there and ran it and it worked. I do think that I could have used package manager to fix it like Bear suggested (thnx) but right now I need to move on. If I have time to revisit this later I will, but for now I have a project deadline to meet, so I'm going to keep moving.