I am writing a Java Servlet, and I am struggling to get a simple HelloWorld
example to work properly.
Error 404: The requested resource is not available using
HelloWorld
servlet
The HelloWorld.java
class is:
package crunch;import java.io.*;import javax.servlet.*;import javax.servlet.http.*;public class HelloWorld extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("Hello World"); }}
I am running Tomcat v7.0, and I have already read similar questions with responses referring to changing the servlet-mapping
section in web.xml
. This section actually doesn't exist in mine, and when I added it the same problem still occurred.