kandi
kandi

Reputation: 1118

Error in compilation servlet

I wrote a simple servlet:

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

public class TestingServlet extends HttpServer {

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        out.println("<H1>Hello world</H1>");
    }
}

I tried to compile it and got:

TestingServlet.java:6: error: cannot find symbol public class TestingServlet extends HttpServer { ^ symbol: class HttpServer 1 error

How can I fix it?

Upvotes: 1

Views: 476

Answers (1)

Sotirios Delimanolis
Sotirios Delimanolis

Reputation: 279960

I believe you are looking for javax.servlet.http.HttpServlet.

public class TestingServlet extends HttpServlet {

There is no HttpServer class in any of the packages you've imported.

Upvotes: 5

Related Questions