智慧职教: 在Servlet中有如下代码段: public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher dis; _____________________________; dis.forward(request,response); }
举一反三
- 给定如下所示的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); }
- 给定一个Servlet的代码片段如下: Public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ ______ out.println("hi kitty! "); out.close(); } 运行Servlet时输出:hi kitty! 则应在此Servlet下划线处填充如下代码
- 在Servlet中有一段代码为: public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { request.setAttribute('y', new Integer(100)); response.sendRedirect('show.jsp'); }在show.jsp中;页面结果为 ( )。 A: java.lang.Integer B: 是null C: 100 D: Integer
- 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 { … } } 在下划线处应填写()