在J2EE中,在Servlet1中的doGet和doPost方法中只有如下代码:request.setAttribute("jb","aptech");response.sendRedirect("http://localhost:8080/servlet/Servlet2");那么在Servlet2中使用()可以把属性jb的值取出来。

题目
在J2EE中,在Servlet1中的doGet和doPost方法中只有如下代码:request.setAttribute("jb","aptech");response.sendRedirect("http://localhost:8080/servlet/Servlet2");那么在Servlet2中使用()可以把属性jb的值取出来。

A.Stringstr=request.getAttribute("jb");

B.Stringstr=(String)request.getAttribute("jb");

C.Objectstr=request.getAttribute("jb");

D.取不出来

参考答案和解析
参考答案:D
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

在servlet中的doGet和doPost方法中只有如下代码:() request.setAttribute(”jb”,”aPtech”); response.sendRedirect(”http://localhost:8080/servlet/Servlet2”);那么在Servlet2中使用()可以把属性jb的值取出来

A.String str=request.getAttribute(“jb”);

B.String sir=(String)request.getAttribute(“jb”);

C.Object str=request.getAttribute(“jb“);

D.取不出来


D

第2题:

给定一个 Servlet 的doGet方法中的代码片段,如下: request.setAttribute(“name”,”zhang”); response.sendRedirect(“http://localhost:8080/servlet/MyServlt”); 那么在 MyServlet中可以使用()方法把属性 name的值取出来。

A.String str=request.getAttribute(“name”);

B.String str=(String)request.getAttribute(“name”);

C.Object str=request.getAttribute(“name”);

D.无法取出来


无法取出来

第3题:

2、给定一个 Servlet 的doGet方法中的代码片段,如下: request.setAttribute(“name”,”zhang”); response.sendRedirect(“http://localhost:8080/servlet/MyServlt”); 那么在 MyServlet 中可以使用()方法把属性 name的值取出来。

A.String str=request.getAttribute(“name”);

B.String str=(String)request.getAttribute(“name”);

C.Object str=request.getAttribute(“name”);

D.无法取出来


Stringstr=request.getAttribute(“name”);

第4题:

给定一个 Servlet 的 doGet 方法中的代码片段,如下: request.setAttribute(“name”,”zhang”); response.sendRedirect(“http://localhost:8080/servlet/MyServlt”); 那么在 MyServlet 中可以使用()方法把属性 name 的值取出来。

A.String str=request.getAttribute("name");

B.String str=(String)request.getAttribute("name");

C.Object str=request.getAttribute("name");

D.无法取出来


D

第5题:

在PowerPoint中,若想给“文本框”对象或“文本框占位符”设置动画效果,下列说法正确是()。

A.执行quot格式quot菜单的quot幻灯片设计quot命令,右侧有一个相应的设置窗格

B.执行quot幻灯片反映quot菜单的quot自定义动画quot命令,右侧有一个相应的设置窗格

C.执行quot格式quot菜单的quot幻灯片版式quot命令,右侧有一个相应的设置窗格

D.以上说法全错


参考答案B

第6题:

在PowerPoint 2003启动幻灯片放映的操作中,错误的是()。

A.单击演示文稿窗口左下角的quot幻灯片放映quot视图按钮

B.选择quot幻灯片放映quot菜单中的quot观看放映quot命令

C.选择quot幻灯片放映quot菜单中的quot幻灯片放映quot命令

D.按F5键


参考答案C

第7题:

在PowerPoint 2003中,删除幻灯片的操作可以是()。

A.单击常用工具栏中的quot粘贴quot按钮

B.选择quot编辑quot菜单中的quot删除幻灯片quot选项

C.选择quot编辑quot菜单中的quot清除quot选项

D.单击常用工具栏中的quot复制quot按钮


参考答案B

第8题:

在j2ee中,有如下代码在servlet1.java中Importantjavax.servelt.*;Importantjavax.servlet.http.*Importjava.io.ioexceptionImportjava.io.printwriterPublicclassservlet1extendshttpservlet{Publicvoidinit()throwsserveltexception{}Publicvoidservice(httpserveltrequestrequest,httpserbletresponseresponse)throwsservletexception,ioexception{Printwriterout=response.getwriter();Out.println(hello”);}}假如编译serblet要具备的环境都已经建立好,现在用完全正确的命令编译该文件,对于以下陈述正确的是()

A.编译该文件时会提示缺少doget()或者dopost()方法,编译不能够成功通过

B.编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,会看到输出文字:“hello”

C.编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,却看不到任何输出的文字

D.编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,却看到产生运行时错误的出差信息


参考答案:B

第9题:

在J2EE中,Servlet1的代码如下:importjavax.servlet.*;importjavax.servlet.http.*;importjava.io.*;publicclassServlet1extendsHttpServlet{publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{response.setContentType("text/html");PrintWriterout=response.getWriter();Stringaa=request.getQueryString();Stringbb=request.getMethod();out.println(aa);out.println(bb);}}把Servlet1.class文件放在Web服务器适合的目录下,在浏览B器地址栏内输入:http://localhost:8080/servlet/Servlet1?name=jb-aptech&phone=12345678,看到的结果是()。

A.name=jb-aptech&phone=12345678GET

B.name=jb-aptech,phone=12345678GET

C.jb-aptech,12345678POST

D.name,phoneGET

E.2,POST


参考答案:A