I have just started learning Java EE and recently got stuck to a problem. I am using eclipse Galileo and installed Tomcat 6.0 version. I needed to create a small Hello World servlet program for which I did the following.
- Created a dynamic web project (firstServlet) and inside Java Resource:src created a package.
- Under package I created a servlet by name 'HelloServlet' and url pattern as '/hello'.
- In HelloServlet I just override service method taking HttpServletRequest & HttpServletResponse parameters. Further I did
response.getWriter.println("Hello Servlet")to print message on browser. - Issue is when I hit the url as
http://localhost:8080/firstServlet/hello, I am always getting a 404 error.
I did crosscheck that my Tomcat is using port 8080.
type Status report
message /firstProject/hello
description The requested resource (/firstProject/hello) is not available. Please Help.
web.xmlor by@WebServlet? - Diogo Moreira