在我向以下 servlet 发出 GET 请求后,文本“In service method”被写入,无法解释。这是为什么?
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class MyServlet extends HttpServlet {
public void service(HttpServletRequest req,
HttpServletResponse resp) throws IOException {
Writer out = resp.getWriter();
out.write("In Service method");
}
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
Writer out = resp.getWriter();
out.write("In get method");
}
}