给定一个Servlet程序的代码片段如下:Public void doPost(HttpServletRequest request,HttpServletResponse response) throw ServletException,IOException{Request.getSession().getAttribute(“A”); //第2行}假定第2行返回的对象引用不是null,那么这个对象存储在()范围中。
A: page
B: application
C: request
D: session
A: page
B: application
C: request
D: session
举一反三
- 智慧职教: 在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