Java Servlet interface is expected here

I am absolutely new to Java.

I am creating a Servlet and getting the error interface is expected here.

Can you please make me understand the problem(s)?

I am using IntelliJ 14.

My Servlet code is as follows:-

package ERPdetector;  

/** 
 * Created by Sinha on 12/15/14. 
 */  

import javax.servlet.http.*;  
import javax.servlet.*;  
import java.io.*;  

public class ErpServlet implements HttpServlet {  

    public void doGet(HttpServletRequest req,HttpServletResponse res)  
            throws ServletException,IOException  
    {  
        res.setContentType("text/html");  
        PrintWriter pw=res.getWriter();  

        String dropdown=req.getParameter("dropdown");  
        pw.println("You Requested for "+dropdown);  

        pw.close();  
    }  
}  

Thanks in Advance.

Jon Skeet
people
quotationmark

HttpServlet is an abstract class, not an interface - Servlet is an interface, but you rarely implement that directly.

Just change this:

public class ErpServlet implements HttpServlet { 

to

public class ErpServlet extends HttpServlet { 

and you should be fine.

people

See more on this question at Stackoverflow