-1

I am working on a tutorial to learn how to build a basic web app on eclipse, run locally on tomcat. However I can't seem to access the HTTPServlet class, while it appears that I can still import other javax.servlet.http files.

package org.eclipse.wtp.tutorial;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HTTPServlet; //This import has an error, "Cannot be resolved"
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SnoopServlet extends HTTPServlet {}

I have gone through these stack overflow answers with no changes to my situation:
Importing servlet API
Adding Runtime

And I wanted to try the second answer of adding a dependency to the project, but there is no pom, and this way of adding a dependency isn't working for me (I don't have the options necessary to do #3)

What is going wrong here?

Community
  • 1
  • 1
efong5
  • 356
  • 1
  • 5
  • 18

2 Answers2

1

In Java, class names are case sensitives. The correct name is HttpServlet (lowercase).

Manu
  • 3,947
  • 7
  • 45
  • 92
0
import javax.servlet.http.HttpServlet; //this is correct
import javax.servlet.http.HTTPServlet; //incorrect
Birhan Nega
  • 605
  • 14
  • 22