给定如下所示的Java Servlet代码片段,用户在浏览器地址栏中键入正确的请求URL并回车后,在控制台上显示的结果是()。 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ System.out.println(“get”); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ System.out.println(“post”); } protected void service(HttpServletRequest req, HttpSergvletResponse resp) throws ServletException, IOException{ System.out.println(“service”); }
举一反三
- 中国大学MOOC: 给定某Servlet程序的片段如下,用户在浏览器地址栏中键盘键入正确的请求URL并回车后,在控制台上显示的结果是( )。 public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException ,IOException{ System.out.println(get); } public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException ,IOException { System.out.println(post); }
- LoginServlet是一个Servlet类,代码如下 public class LoginServlet extends ___________ { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { … } public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { … } } 在下划线处应填写()
- 智慧职教: 在Servlet中有如下代码段: public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher dis; _____________________________; dis.forward(request,response); }
- 给定一个Servlet的代码片段如下: Public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ ______ out.println("hi kitty! "); out.close(); } 运行Servlet时输出:hi kitty! 则应在此Servlet下划线处填充如下代码
- 阅读下列的代码 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ out.println("hello kity!"); } 若使Servlet运行的结果为hi kitty!,填写在空白处的代码为() 则应在此Servlet下划线处添加如下()代码