年JSP程序开发期末考试小抄.doc

上传人:文库蛋蛋多 文档编号:2198081 上传时间:2023-01-29 格式:DOC 页数:2 大小:198.51KB
返回 下载 相关 举报
年JSP程序开发期末考试小抄.doc_第1页
第1页 / 共2页
年JSP程序开发期末考试小抄.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《年JSP程序开发期末考试小抄.doc》由会员分享,可在线阅读,更多相关《年JSP程序开发期末考试小抄.doc(2页珍藏版)》请在三一办公上搜索。

1、专业好文档1JSP页面以( B)为扩展名进行保存。A. .jps B. .jsp C. .java D. .JSP2在JSP中如果要导入 java.io.* 包,应该使用( A )指令。A. page B. taglib C. include D. forward3如果当前JSP页面出现异常时需要转到一个异常页,需要设置page 指令的( D)属性。A. ExceptionB. isErrorPageC. errorD. errorPage4JSP中的隐式注释为( C )。A. / 注释内容B. C. D. /* 注释内容 */5使用response对象进行重定向时使用的方法为( B )。A.

2、getAttribute( )B. sendRedirect( )C. setContentType( )D. setAttribute( )6如果把用户名变量UserName放在session对象中,下面语句正确的是( D)A.session.setName(UserName) B. session.setName(“name”,UserName)C. session.setAttribute(UserName) D. session.setAttribute(“name”,UserName)7在JSP中,test.jsp文件中有如下一行代码:要使user对象中一直存在于对话中,直至其终止或

3、被删除为止,下划线中应填入( C )。A.page B.request C.session D.application8在JSP中,使用动作可以将javaBean嵌入JSP页面,对JavaBean的访问范围不能是C A. pageB. request C. responseD. application9在JSP中,( A )动作用于将请求转发给其他JSP页面。 A.forward B.include C.useBean D.setProperty10.JSP中使用标记时,不会出现的属性是:(C)。A.name B.property C.value D.以上皆不会出现11.在标记中包含哪个标记(

4、 D )?A.case B.choose C.checkD.when12.下面哪个标记产生的结果同( C )。A. B. C. D. 13.每次传递请求或响应时调用Filter的( B )方法。A.init() B.doFilter() C.destroy() D.getInitParameter14.Struts Bean的( B )标记检索Web应用程序资源的结果。A.define B.include C.message D.page15Servlet程序的入口点是:AA.init()B.main()C.service()D.doGet16.下述选项中不属于JDBC基本功能的是:( D )

5、。A.与数据库建立连接 B.提交SQL语句 C.处理查询结果D.数据库维护管理17.在标记中包含哪个标记( D )?A.caseB.chooseC.checkD.when18.Tomcat服务器的默认端口是 8080 。1.JSP 是_sun_ 公司倡导,由多家公司参与一起建立的一种动态网页技术标准,主要用于开发动态网页。2.指令元素分为三种:它们分别是:Page 、Include 、和Taglib。3.JDBC的主要任务是: 与数据库建立连接 、 发送SQL语句 、 处理结果 。4.Servlet的生命周期分三个时期:装载Servlet 、 创建一个Servlet实例、销毁。5.在JSP中,

6、当执行了查询操作时,一般将查询结果保存在 ResultSet 对象中。6.在JSP规范中,可以使用两种格式的注释:一种是输出注释;别一种 是隐藏注释 。7.在JSP内置对象中,与请求相关的对象是 Request 对象。8.客户端向服务器端提交数据的方式通常有两种:一种是Get提交方式;另一种是Post提交方式。9.JSP规范中描述了3种脚本元素: 声明 、 表达式 和 脚本程序 。10.在JSP中,连接数据库的方式通常有两种:一种是通过JDBC-ODBC桥连接;另一种是通过JDBC驱动程序连接。11.JDBC中为Statement接口提供了3种执行方法,它们是:executeUpdate方法、

7、executeQuery方法 、execute方法 。9.在JSP中,可以使用 操作来设置Bean的属性,也可以使用 操作来获取Bean的值。10.异常的处理,可在该 方法的代码段中包含3类代码:try 、 catch和finally代码块。11.JDBC中为Statement接口提供了3种执行方法,它们是:executeUpdate方法、executeQuery方法 、execute方法 。12.取表单()提交的参数,通常使用的内部对象是request ,方法是 getParameter 。1编写JSP页面分别显示110之间各数字的阶乘。答案: 阶乘(Factorial) %! long F

8、actorial(int n) int sum=1; for(int i=1;i 1到10之间的各数字的阶乘% long sum; for(int j=1;j=10;j+) sum=Factorial(j); out.print(+j+!=+sum); % 1)在JSP中,要定义一个方法,需要用到以下(c)元素。(选择一项)a) b) c) d) 2)JSP页面经过编译之后,将创建一个()。(选择一项)Ba) applet b) servletc) applicationd) exe文件7) 在JSP中,page指令的()属性用来引入需要的包或类。(选择一项)Ba) extends b) im

9、portc) languge d) contentType8) 在Servlet过滤器的生命周期方法中,每当传递请求或响应时,web容器会调用(C)方法。a) initb) servicec) doFilterd) destroy9) 在JSP中,只有一行代码:,运行将输出()。(选择一项)Ca) A+Bb) ABc) 131d) 错误信息,因为表达式是错误的10)给定一个Servlet的代码片段如下:Public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException

10、,IOException_out.println(“hi kitty!”);out.close();运行次Servlet时输出如下:hi kitty!则应在此Servlet下划线处填充如下代码。(选项一项)Aa)PrintWriter out = response.getWriter();b)PrintWriter out = request.getWriter();c)OutputStream out = response.getOutputStream();d)OutputStream out = request.getWriter();13)某JSP程序中声明使用javaBean的语句如

11、下:BC要取出该javaBean的loginName属性值,以下语句正确的是().(选择两项)a)b)c)d)15)给顶一个JSP程序源代码,如下:在two.jsp中使用(D)代码片段可以输出参数location的值。ab)cd)18) 如JSP页面执行时遇到自定义标签,doStartTag()方法将被调用(A)次。(选择一项) a) 1b) 1或多 c) 0或1d) 0或多19) 给定include1.jsp文件代码片断,如下: _/此处填写代码给定include2.jsp文件代码片断,如下:要求运行include1.jsp时,浏览器上输出:HAHA要满足以上条件,jsp1.jsp中下划线处

12、应填入以下(B)语句。(选择一项)a)b)c)d)24) 要设置某个JSP页面为错误处理页面,以下page指令正确的是(B)。 ab)c)d) 26) 在Servlet里,能正确获取session的语句是(A)。 (选择一项)a) HttpSession session = request.getSession(true);b)HttpSession session = request.getHttpSession(true);c)HttpSession session = response.getSession(true);d)HttpSession session = response.

13、getHttpSession (true);27) 在JSP中,(A)动作用于将请求转发给其他JSP页面。 (选择一项)a)forward b)includec)useBeand)setProperty30) 给定JSP程序源码如下,可以在下划线处插入并且能够正确输出WELCOME,JACK的语句是()。 (选择二项)WELCOME,_BD_a)nameb)c)out.println(name);d)32) 在JSP中,使用动作可以将javaBean嵌入JSP页面,对JavaBean的访问范围不能是(C)a)pageb)requestc)responsed)application34) Ser

14、vlet中,使用()接口中定义的(B)方法来处理客户端发出的表单数据请求 (选一项)a) HttpServlet doHeadb) HttpServlet doPostc) ServletRequest doGetd) ServletRequest doPost35) 给定JSP程序源码如下,该JSP运行后输出的结果是(D)。 (选择一项) Count: a) Count:1b) Count:2c) 1:2d) Count:给定JSP程序源码如下: _以下(D)语句可以在下划线处插入,并且运行后输出结果是:1。a) b) c) d) 47) servlet 的生命周期又一系列事件组成,把这些事

15、件按照先后顺序排序,以下正确的是(B)(选择一项)a) 加载类,实例化,请求处理,初始化,销毁b) 加载类,实例化,初始化,请求处理,销毁c) 实例化,加载类,初始化,请求处理,销毁d) 加载类,初始化,实例化,请求处理,销毁1、 Tomcat服务器的默认端口是8080。怎样修改tomcat的端口在Tomcat下打开conf文件夹找到server.xml文件用记事本打开在中把8080更改即可,2、 异常的处理,可在该方法的代码段中包含3类代码:try、catch和finally代码块。3、 jsp主要内置对象有:application、exception、pageContext、request

16、、session、response_out、config、page。5、 application对象是 代表应用程序上下文,它允许JSP页面与包括在同一应用程序中的任何Web组件共享信息,而session对象则是每个客户专用的。6、 JDBC的主要任务是: 与数据库建立连接、发送SQL语句、 处理结果。7、 一个Bean由三部分组成:实现java.io.serializable接口、提供无参数的构造方法、提供getter()和setter()方法访问它的属性。8、 Java Servlet的主要特点是:运行高效、方便、功能强大、节省投资。运行servlet需要在web.xml注册.9、 Ser

17、vlet的生命周期分三个时期:装载Servlet、创建一个Servlet实例、销毁。10、 JSP开发网站的两种模式分为jsp+javabean_和sp+javabean+servlet。 1、下面哪一个不是JSP本身已加载的基本类?(b )A、java.lang.* B、java.io.* C、javax.servlet.* D、javax.servlet.jsp.*2、对于预定义的说法错误的是:(c)A、一次可声明多个变量和方法,只要以“;”结尾就行B一个声明仅在一个页面中有效C、声明的变量将作为局部变量 D、在预定义中声明的变量将在JSP页面初始化时初始化3、从 “员工” 表的“姓名”字

18、段中找出名字包含“玛丽”的人,下面哪条select语句正确:( D )A、 Select * from员工 where 姓名 =_玛丽_ B 、Select * from员工 where 姓名 =%玛丽_C、 Select * from员工 where 姓名 like _玛丽% D、 Select * from员工 where 姓名 like %玛丽%4、下述选项中不属于JDBC基本功能的是:( D )A. 与数据库建立连接 B. 提交SQL语句 C. 处理查询结果 D. 数据库维护管理5、在JSP中使用标记时,不会出现的属性是:( c )A.name B.propertyC. value D

19、. 以上皆不会出现6、Page指令用于定义JSP文件中的全局属性,下列关于该指令用法的描述不正确的是:(D )A. 作用于整个JSP页面。 B. 可以在一个页面中使用多个指令。C. 为增强程序的可读性,建议将指令放在JSP文件的开头,但不是必须的。D.指令中的属性只能出现一次。7、在JSP中调用JavaBean时不会用到的标记是:( A )A.B.C. D.8、关于JavaBean正确的说法是:( A)A、Java文件与Bean所定义的类名可以不同,但一定要注意区分字母的大小写B、在JSP文件中引用Bean,其实就是用语句C、被引用的Bean文件的文件名后缀为.java D、Bean文件放在任

20、何目录下都可以被引用10、 不能在不同用户之间共享数据的方法是(A )A、通过cookie B、利用文件系统 C、利用数据库 D、通过ServletContext对象Winger Tuivasa-Sheck, who scored two tries in the Kiwis 20-18 semi-final win over England, has been passed fit after a lower-leg injury, while Slater has been named at full-back but is still recovering from a knee inj

21、ury aggravated against USA.Both sides boast 100% records heading into the encounter but Australia have not conceded a try since Josh Charnleys effort in their first pool match against England on the opening day.Aussie winger Jarryd Hayne is the competitions top try scorer with nine, closely followed

22、 by Tuivasa-Sheck with eight.But it is recently named Rugby League International Federation player of the year Sonny Bill Williams who has attracted the most interest in the tournament so far.The Kiwi - with a tournament high 17 offloads - has the chance of becoming the first player to win the World

23、 Cup in both rugby league and rugby union after triumphing with the All Blacks in 2011.Id give every award back in a heartbeat just to get across the line this weekend, said Williams.The (lack of) air up there Watch mCayman Islands-based Webb, the head of Fifas anti-racism taskforce, is in London fo

24、r the Football Associations 150th anniversary celebrations and will attend Citys Premier League match at Chelsea on Sunday.I am going to be at the match tomorrow and I have asked to meet Yaya Toure, he told BBC Sport.For me its about how he felt and I would like to speak to him first to find out wha

25、t his experience was.Uefa hasopened disciplinary proceedings against CSKAfor the racist behaviour of their fans duringCitys 2-1 win.Michel Platini, president of European footballs governing body, has also ordered an immediate investigation into the referees actions.CSKA said they were surprised and

26、disappointed by Toures complaint. In a statement the Russian side added: We found no racist insults from fans of CSKA. Baumgartner the disappointing news: Mission aborted.The supersonic descent could happen as early as Sunda.The weather plays an important role in this mission. Starting at the ground

27、, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mou

28、nt Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.The balloon will slowly drift to the edge o

29、f space at 120,000 feet ( Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform.They blew it in 2008 when they got caught cold in the final and they will not make the same mistake against the Kiwis in Manchester.Five years ago they cruised through to the

30、final and so far history has repeated itself here - the last try they conceded was scored by Englands Josh Charnley in the opening game of the tournament.That could be classed as a weakness, a team under-cooked - but I have been impressed by the Kangaroos focus in their games since then.They have be

31、en concentrating on the sort of stuff that wins you tough, even contests - strong defence, especially on their own goal-line, completing sets and a good kick-chase. Theyve been great at all the unglamorous stuff that often goes unnoticed in the stands but not by your team-mates.It is as though their

32、 entire tournament has been preparation for the final.In Johnathan Thurston, Cooper Cronk, Cameron Smith and either Billy Slater or Greg Inglis at full-back they have a spine that is unmatched in rugby league. They have played in so many high-pressure games - a priceless asset going into Saturday.The Kiwis are a lot less experienced but winning a dramatic match like their semi-final against England will do wonders for their confidence.They defeated Australia in the Four Nations final in 2010 and the last World Cup, and know they can rise to the big occasion.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 教育教学 > 成人教育


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号