views:

43

answers:

3

Hi,

I have downloaded eclipse jee version (3.5) and I would like to use it to develop a servlet project on tomcat.

So I

  • install tomcat and add it as my server in my eclipse environment.
  • create a Dynamic Web Project called 'TestServlet'
  • create a new servlet called 'MainServlet'

and then I deploy my project to the tomcat server via eclipse and 'run the server in debug' mode.

But when I use the browser to hit 'http://localhost:8080/TestServlet/MainServlet' I see no resource found (that page is generated by Tomcat, so I know my Tomcat is running).

Can you please tell me what am I missing? Or how can I trouble shoot my problem?

I think it must be some path /name is not set correctly.

+1  A: 

Verify your servlet mapping is correct in web.xml

Flash84x
+2  A: 
  1. Take a look at your web.xml file in your project. You should find an entry for your servlet and a mapping.

    <servlet>
       <servlet-name>MainServlet</servlet-name>
       <servlet-class>your.package.MainServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>MainServlet</servlet-name>
        <url-pattern>/main.do</url-pattern>
     </servlet-mapping>
    

Then the URL you use to access the servlet is:

    http://localhost:8080/main.do
Vincent Ramdhanie
A: 

Did you declare your Servlet in the deployment descriptor (the web.xml file)? How did you map it? I suggest to check the Servlet and JSP development with Eclipse WTP - Tutorial or any other tutorial.

Pascal Thivent