题目内容
给定如下Servlet代码:假定在浏览器中输入URL:http://localhost:8080/servlet/HelloServlet,可以调用这个servlet,那么这个Servlet的输出是import java.io.*;import javax.servlet.*;import javax.servlet.http.*;public class HelloServlet extends HttpServlet{public void service(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException{}public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException {res.setContentType(""text/html"");PrintWriter out = res.getWriter();out.println("""");out.println("""");out.println(""doGet Hello World!"");out.println("""");out.println("""");out.close();}public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException {res.setContentType(""text/html"");PrintWriter out = res.getWriter();out.println("""");out.println("""");out.println(""doPost Hello World!"");out.println("""");}}
查看答案
搜索结果不匹配?点我反馈