admin 管理员组

文章数量: 1086019


2023年12月19日发(作者:表达式abc10isalpha)

一、选择题

(B) 01、WWW的英文全称是___。

A) World Web Wide

B) World Wide Web

C) Web Wide World

D) World Wide Worth

(B) 02、以下__不属于B/S结构特点。

A) 节约成本

B) 维护成本高且投资大

C) 安全

D) 方便

(A) 03、下列__不属于URL的组件部分。

A) 服务器名称

B) 协议类型

C) 路径

D) 文件名

(C) 04、下面关于Html的描述中,错误的是__。

A) HTML文件必须由开头,标记结束。

B) 文档头信息包含在与之间。

C) 在和之间可以包含和<body>等信息。 </p><p style="text-indent: 2em;";> D) 文档体包含在<body>和</body>标记之间 </p><p style="text-indent: 2em;";>(D) 05、下列__不是HTML的常用标记。 </p><p style="text-indent: 2em;";> A) <body> </p><p style="text-indent: 2em;";> B) <head> </p><p style="text-indent: 2em;";> C) <html> </p><p style="text-indent: 2em;";> D) <Book> </p><p style="text-indent: 2em;";>(D) 06、表格在网页中常用于网页的布局排版,下面__不是表格的标记。 </p><p style="text-indent: 2em;";> A) <table> </p><p style="text-indent: 2em;";> B) <tr> </p><p style="text-indent: 2em;";> C) <td> </p><p style="text-indent: 2em;";> D) <th> </p><p style="text-indent: 2em;";>(A) 07、在<a href= * >标记中,*号位置会写上窗口的打开方式。若将内容显示在新的浏览窗口中,应选择__。 </p><p style="text-indent: 2em;";> A) target=_blank </p><p style="text-indent: 2em;";> B) target=_parent </p><p style="text-indent: 2em;";> C) target=_self </p><p style="text-indent: 2em;";> D) target=_top </p><p style="text-indent: 2em;";>(C) 08、Form表单的method属性能取下列__值。 </p><p style="text-indent: 2em;";> A) submit </p><p style="text-indent: 2em;";> B) puts </p><p style="text-indent: 2em;";> C) post </p><p style="text-indent: 2em;";> D) out </p><p style="text-indent: 2em;";>(C) 09、在HTML文件中导入一个样式表的正确语法为__。 </p><p style="text-indent: 2em;";> A) <link href="" rel="stylesheet" </p><p style="text-indent: 2em;";>type="text/css"> </p><p style="text-indent: 2em;";> B) <input href="" rel="stylesheet" </p><p style="text-indent: 2em;";>type="text/css"> </p><p style="text-indent: 2em;";> C) <import href="" rel="stylesheet" </p><p style="text-indent: 2em;";>type="text/css"> </p><p style="text-indent: 2em;";> D) <link src="" rel="stylesheet" </p><p style="text-indent: 2em;";>type="text/css"> </p><p style="text-indent: 2em;";>(C) 10、Http的中文含义为__。 </p><p style="text-indent: 2em;";> A) 统一资源定位器 </p><p style="text-indent: 2em;";> B) 简单邮件传输协议 </p><p style="text-indent: 2em;";> C) 超文本传输协议 </p><p style="text-indent: 2em;";> D) 网络套接字 </p><p style="text-indent: 2em;";>(A) 11、CSS指的是__。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> A) 层叠样式表 </p><p style="text-indent: 2em;";> B) 脚本语言 </p><p style="text-indent: 2em;";> C) 标记语言 </p><p style="text-indent: 2em;";> D) 扩展标记语言 </p><p style="text-indent: 2em;";>(D) 12、CSS选择器通过被规则指定的标记,对文档中使用该标记的内容进行统一的外观控制。下面__不是CSS选择器。 </p><p style="text-indent: 2em;";> A) 标记选择器 </p><p style="text-indent: 2em;";> B) 类型选择器 </p><p style="text-indent: 2em;";> C) ID选择器 </p><p style="text-indent: 2em;";> D) 名称选择器 </p><p style="text-indent: 2em;";>(A) 13、URL中文名称是__。 </p><p style="text-indent: 2em;";> A) 统一资源定位器 </p><p style="text-indent: 2em;";> B) 网络资源 </p><p style="text-indent: 2em;";> C) 网络协议 </p><p style="text-indent: 2em;";> D) 数据链接 </p><p style="text-indent: 2em;";>(A) 14、URL是Internet中资源的命名机制,URL由__三部分构成。 </p><p style="text-indent: 2em;";> A) 协议、主机DNS名或IP地址和文件名 </p><p style="text-indent: 2em;";> B) 主机、DNS名或IP地址和文件名、协议 </p><p style="text-indent: 2em;";> C) 协议、文件名、主机名 </p><p style="text-indent: 2em;";> D) 协议、文件名、IP地址 </p><p style="text-indent: 2em;";>(C) 15、下列__不属于URL的组件部分。 </p><p style="text-indent: 2em;";> A) 协议 </p><p style="text-indent: 2em;";> B) IP地址或域名 </p><p style="text-indent: 2em;";> C) 服务器名称 </p><p style="text-indent: 2em;";> D) 端口号 </p><p style="text-indent: 2em;";>(B) 16、以下__语句是从表TABLE_NAME中提取前10条记录。 </p><p style="text-indent: 2em;";> A) select * from TABLE_NAME where rowcount=10 </p><p style="text-indent: 2em;";> B) select TOP 10 * from TABLE_NAME </p><p style="text-indent: 2em;";> C) select TOP of 10 * from TABLE_NAME </p><p style="text-indent: 2em;";> D) select * from TABLE_NAME where rowcount<=10 </p><p style="text-indent: 2em;";>(D) 17、从“员工”表的“姓名”字段中找出名字包含“玛丽”的人,___语句是正确的。 </p><p style="text-indent: 2em;";> A) Select * from 员工 where 姓名 ='玛丽' </p><p style="text-indent: 2em;";> B) Select * from 员工 where 姓名 ='%玛丽' </p><p style="text-indent: 2em;";> C) Select * from 员工 where 姓名 like '玛丽%' </p><p style="text-indent: 2em;";> D) Select * from 员工 where 姓名 like '%玛丽%' </p><p style="text-indent: 2em;";>(C) 18、下列__完整性中,将每一条记录定义为表中的惟一实体,即不能重复。 </p><p style="text-indent: 2em;";> A) 域完整性 </p><p style="text-indent: 2em;";> B) 引用完整性 </p><p style="text-indent: 2em;";> C) 实体完整性 </p><p style="text-indent: 2em;";> D) 行列完整性 </p><p style="text-indent: 2em;";>(D) 19、关系模型中实体与实体间的联系的表是通过__。 </p><p style="text-indent: 2em;";> A) 表 </p><p style="text-indent: 2em;";> B) 图 </p><p style="text-indent: 2em;";> C) 树 </p><p style="text-indent: 2em;";> D) 关系 </p><p style="text-indent: 2em;";>(B) 20、当多个用户请求同一个JSP页面时,Tomcat服务器为每个客户启动一个__。 </p><p style="text-indent: 2em;";> A) 进程 </p><p style="text-indent: 2em;";> B) 线程 </p><p style="text-indent: 2em;";> C) 程序 </p><p style="text-indent: 2em;";> D) 服务 </p><p style="text-indent: 2em;";>(D) 21、以下__不是JSP运行所必须的条件。 </p><p style="text-indent: 2em;";> A) 操作系统 </p><p style="text-indent: 2em;";> B) JavaJDK </p><p style="text-indent: 2em;";> C) 支持Jsp的Web服务器 </p><p style="text-indent: 2em;";> D) 数据库 </p><p style="text-indent: 2em;";>1 </p><p style="text-indent: 2em;";>(C) 22、下列说法中正确的是__。 </p><p style="text-indent: 2em;";> A) Apache用于ASP技术所开发网站的服务器 </p><p style="text-indent: 2em;";> B) IIS用于CGI技术所开发网站的服务器 </p><p style="text-indent: 2em;";> C) Tomcat用于JSP技术所开发网站的服务器 </p><p style="text-indent: 2em;";> D) WebLogic用于PHP技术所开发网站的服务器 </p><p style="text-indent: 2em;";>(C) 23、Tomcat服务器的默认端口为__。 </p><p style="text-indent: 2em;";> A) 8888 </p><p style="text-indent: 2em;";> B) 8001 </p><p style="text-indent: 2em;";> C) 8080 </p><p style="text-indent: 2em;";> D) 80 </p><p style="text-indent: 2em;";>(A) 24、Tomcat的端口号可以在__文件中修改。 </p><p style="text-indent: 2em;";> A) </p><p style="text-indent: 2em;";> B) </p><p style="text-indent: 2em;";> C) </p><p style="text-indent: 2em;";> D) 不能改 </p><p style="text-indent: 2em;";>(D) 25、如果想在tomcat服务器启动时将jar包加载到内存,且该jar包可以被tomcat服务器上所有的应用使用,应该将该jar包复制到tomcat的__目录。 </p><p style="text-indent: 2em;";> A) common </p><p style="text-indent: 2em;";> B) server </p><p style="text-indent: 2em;";> C) commonlib </p><p style="text-indent: 2em;";> D) serverlib </p><p style="text-indent: 2em;";>(C) 26、下列变量声明在__范围内有效。 </p><p style="text-indent: 2em;";> <%! Date dateTime; </p><p style="text-indent: 2em;";> int countNum; %> </p><p style="text-indent: 2em;";> A) 从定义开始处有效,客户之间不共享 </p><p style="text-indent: 2em;";> B) 在整个页面内有效,客户之间不共享 </p><p style="text-indent: 2em;";> C) 在整个页面内有效,被多个客户共享 </p><p style="text-indent: 2em;";> D) 从定义开始处有效,被多个客户共享 </p><p style="text-indent: 2em;";>(C) 27、在“<%!”和“%>”标记之间声明的Java的方法称为页面的成员方法,其在__范围内有效。 </p><p style="text-indent: 2em;";> A) 从定义处之后有效。 </p><p style="text-indent: 2em;";> B) 在整个页面内有效。 </p><p style="text-indent: 2em;";> C) 从定义处之前有效。 </p><p style="text-indent: 2em;";> D) 不确定。 </p><p style="text-indent: 2em;";>(B) 28、JSP页面可以在“<%=”和“%>”标记之间放置Java表达式,直接输出Java表达式的值。组成“<%=”标记的各字符之间__。 </p><p style="text-indent: 2em;";> A) 可以有空格 </p><p style="text-indent: 2em;";> B) 不可以有空格 </p><p style="text-indent: 2em;";> C) 必须有空格 </p><p style="text-indent: 2em;";> D) 不确定 </p><p style="text-indent: 2em;";>(A) 29、JSP的Page编译指令的属性Language的默认值是__。 </p><p style="text-indent: 2em;";> A) Java </p><p style="text-indent: 2em;";> B) C </p><p style="text-indent: 2em;";> C) C# </p><p style="text-indent: 2em;";> D) SQL </p><p style="text-indent: 2em;";>(A) 30、在WEB应用程序的目录结构中,在WEB-INF文件夹外的文件为__。 </p><p style="text-indent: 2em;";> A) .jsp文件 </p><p style="text-indent: 2em;";> B) .class文件 </p><p style="text-indent: 2em;";> C) .jar文件 </p><p style="text-indent: 2em;";> D) 文件 </p><p style="text-indent: 2em;";>(C) 31、创建JSP应用程序时,配置文件应该在程序下的__目录中。 </p><p style="text-indent: 2em;";> A) admin </p><p style="text-indent: 2em;";> B) servlet </p><p style="text-indent: 2em;";> C) WEB-INF </p><p style="text-indent: 2em;";> D) WebRoot </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>(B) 32、jsp最终被运行的是__文件。 </p><p style="text-indent: 2em;";> A) java </p><p style="text-indent: 2em;";> B) class </p><p style="text-indent: 2em;";> C) HTML </p><p style="text-indent: 2em;";> D) JSP </p><p style="text-indent: 2em;";>(B) 33、下面___不是JSP本身已加载的基本类。 </p><p style="text-indent: 2em;";> A) .* </p><p style="text-indent: 2em;";> B) .* </p><p style="text-indent: 2em;";> C) t.* </p><p style="text-indent: 2em;";> D) .* </p><p style="text-indent: 2em;";>(C) 34、对于预定义<%!预定义%>的说法错误的是___。 </p><p style="text-indent: 2em;";> A) 一次可声明多个变量和方法,只要以“;”结尾就行 </p><p style="text-indent: 2em;";> B) 一个声明仅在一个页面中有效 </p><p style="text-indent: 2em;";> C) 声明的变量将作为局部变量 </p><p style="text-indent: 2em;";> D) 在预定义中声明的变量将在JSP页面初始化时初始化 </p><p style="text-indent: 2em;";>(B) 35、include指令用于在JSP页面静态插入一个文件,插入文件可以是JSP页面、HTML网页、文本文件或一段Java代码,但必须保证插入后形成的文件是__。 </p><p style="text-indent: 2em;";> A) 是一个完整的HTML文件 </p><p style="text-indent: 2em;";> B) 是一个完整的JSP文件 </p><p style="text-indent: 2em;";> C) 是一个完整的TXT文件 </p><p style="text-indent: 2em;";> D) 是一个完整的Java源文件 </p><p style="text-indent: 2em;";>(A) 36、在Jsp页面中,Java程序代码应插入在__标记之间。 </p><p style="text-indent: 2em;";> A) <% 和 %> </p><p style="text-indent: 2em;";> B) <% 和 /> </p><p style="text-indent: 2em;";> C) </ 和 %> </p><p style="text-indent: 2em;";> D) <% 和 !> </p><p style="text-indent: 2em;";>(B) 37、可以在以下__标记之间插入变量与方法声明。 </p><p style="text-indent: 2em;";> A) <% 和 %> </p><p style="text-indent: 2em;";> B) <%! 和 %> </p><p style="text-indent: 2em;";> C) </ 和 %> </p><p style="text-indent: 2em;";> D) <% 和 !> </p><p style="text-indent: 2em;";>(A) 38、jsp中java表达式的语法格式为__。 </p><p style="text-indent: 2em;";> A) <%= %> </p><p style="text-indent: 2em;";> B) <%! %> </p><p style="text-indent: 2em;";> C) <%@ %> </p><p style="text-indent: 2em;";> D) <% %> </p><p style="text-indent: 2em;";>(C) 39、下列__注释为隐藏型注释。 </p><p style="text-indent: 2em;";> A) <!-- 注释内容 [<%= 表达式 %>] --> </p><p style="text-indent: 2em;";> B) <!-- 注释内容 --> </p><p style="text-indent: 2em;";> C) <%-- 注释内容 --%> </p><p style="text-indent: 2em;";> D) <!—[<%= 表达式 %>] --> </p><p style="text-indent: 2em;";>(A) 40、在JSP中,<%="1+4"%>将输出__。 </p><p style="text-indent: 2em;";> A) 1+4 </p><p style="text-indent: 2em;";> B) 5 </p><p style="text-indent: 2em;";> C) 14 </p><p style="text-indent: 2em;";> D) 不会输出,因为表达式是错误的 </p><p style="text-indent: 2em;";>(C) 41、在JSP中,要定义一个方法,需要用到以下__元素。 </p><p style="text-indent: 2em;";> A) <%= %> </p><p style="text-indent: 2em;";> B) <% %> </p><p style="text-indent: 2em;";> C) <%! %> </p><p style="text-indent: 2em;";> D) <%@ %> </p><p style="text-indent: 2em;";>(C) 42、要在jsp中使用ArrayList,,__做法是正确的。 </p><p style="text-indent: 2em;";> A) <% import ist%> </p><p style="text-indent: 2em;";> B) <%@ import "ist"%> </p><p style="text-indent: 2em;";> C) <%@ page import="ist"%> </p><p style="text-indent: 2em;";> D) <%@ page package="ist"%> </p><p style="text-indent: 2em;";>(B) 43、在JSP中,page指令的__属性用来引入需要的包2 </p><p style="text-indent: 2em;";>或类。 </p><p style="text-indent: 2em;";> A) extends </p><p style="text-indent: 2em;";> B) import </p><p style="text-indent: 2em;";> C) languge </p><p style="text-indent: 2em;";> D) contentType </p><p style="text-indent: 2em;";>(B) 44、能在浏览器的地址栏中看到提交数据的表单提交方式是__。 </p><p style="text-indent: 2em;";> A) submit </p><p style="text-indent: 2em;";> B) get </p><p style="text-indent: 2em;";> C) post </p><p style="text-indent: 2em;";> D) out </p><p style="text-indent: 2em;";>(D) 45、下面不属于JSP内置对象的是__。 </p><p style="text-indent: 2em;";> A) out对象 </p><p style="text-indent: 2em;";> B) respone对象 </p><p style="text-indent: 2em;";> C) application对象 </p><p style="text-indent: 2em;";> D) page对象 </p><p style="text-indent: 2em;";>(A) 46、在JSP页面中,能够完成输出操作的内置对象是__。 </p><p style="text-indent: 2em;";> A) out </p><p style="text-indent: 2em;";> B) response </p><p style="text-indent: 2em;";> C) request </p><p style="text-indent: 2em;";> D) config </p><p style="text-indent: 2em;";>(C) 47、out对象是一个输出流,其输出各种类型数据并换行的方法是__。 </p><p style="text-indent: 2em;";> A) () </p><p style="text-indent: 2em;";> B) e() </p><p style="text-indent: 2em;";> C) n() </p><p style="text-indent: 2em;";> D) () </p><p style="text-indent: 2em;";>(A) 48、out对象是一个输出流,其输出不换行的方法是__。 </p><p style="text-indent: 2em;";> A) () </p><p style="text-indent: 2em;";> B) e() </p><p style="text-indent: 2em;";> C) n() </p><p style="text-indent: 2em;";> D) () </p><p style="text-indent: 2em;";>(C) 49、在JSP中的Java脚本中输出数据时可以使用__对象的print()方法。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) session </p><p style="text-indent: 2em;";> C) out </p><p style="text-indent: 2em;";> D) application </p><p style="text-indent: 2em;";>(D) 50、以下__对象提供了访问和放置页面中共享数据的方式。 </p><p style="text-indent: 2em;";> A) pageContext </p><p style="text-indent: 2em;";> B) response </p><p style="text-indent: 2em;";> C) request </p><p style="text-indent: 2em;";> D) session </p><p style="text-indent: 2em;";>(A) 51、如果只希望在多个页面间共享数据,可以使用__作用域。 </p><p style="text-indent: 2em;";> A) request,session </p><p style="text-indent: 2em;";> B) application,session </p><p style="text-indent: 2em;";> C) request,application </p><p style="text-indent: 2em;";> D) pageContxt,request </p><p style="text-indent: 2em;";>(D) 52、编写计数器程序用来记载当前网站的访问量,建议采用JSP中的__对象。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) session </p><p style="text-indent: 2em;";> C) request </p><p style="text-indent: 2em;";> D) application </p><p style="text-indent: 2em;";>(C) 53、sesson对象的__方法用于判断是否为开始新会话。 </p><p style="text-indent: 2em;";> A) begin() </p><p style="text-indent: 2em;";> B) isNewSessionID() </p><p style="text-indent: 2em;";> C) isNew() </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> D) invalidate() </p><p style="text-indent: 2em;";>(B) 54、在JSP中如果要获取客户端主机名,应使用request对象的__方法。 </p><p style="text-indent: 2em;";> A) getServerName() </p><p style="text-indent: 2em;";> B) getRemoteHost() </p><p style="text-indent: 2em;";> C) server() </p><p style="text-indent: 2em;";> D) getRemotePort() </p><p style="text-indent: 2em;";>(A) 55、可以利用request对象的__方法获取客户端的表单信息。 </p><p style="text-indent: 2em;";> A) ameter() </p><p style="text-indent: 2em;";> B) ameter() </p><p style="text-indent: 2em;";> C) arameter() </p><p style="text-indent: 2em;";> D) rParameter() </p><p style="text-indent: 2em;";>(C) 56、调用getCreationTime()可以获取session对象创建的时间,该时间的单位是__。 </p><p style="text-indent: 2em;";> A) 秒 </p><p style="text-indent: 2em;";> B) 分秒 </p><p style="text-indent: 2em;";> C) 毫秒 </p><p style="text-indent: 2em;";> D) 微秒 </p><p style="text-indent: 2em;";>(A) 57、可以利用JSP动态改变客户端的响应,使用的语法是__。 </p><p style="text-indent: 2em;";> A) der() </p><p style="text-indent: 2em;";> B) der() </p><p style="text-indent: 2em;";> C) eader() </p><p style="text-indent: 2em;";> D) rHeader() </p><p style="text-indent: 2em;";>(C) 58、在WEB应用程序的目录结构中,在WEB-INF文件夹中的lib目录是存放__文件的。 </p><p style="text-indent: 2em;";> A) .jsp文件 </p><p style="text-indent: 2em;";> B) .class文件 </p><p style="text-indent: 2em;";> C) .jar文件 </p><p style="text-indent: 2em;";> D) 文件 </p><p style="text-indent: 2em;";>(D) 59、在J2EE中,request对象的__方法可以获取页面请求中一个表单组件对应多个值时的用户的请求数据。 </p><p style="text-indent: 2em;";> A) String getParameter(String name) </p><p style="text-indent: 2em;";> B) String[] getParameter(String name) </p><p style="text-indent: 2em;";> C) String getParameterValuses(String name) </p><p style="text-indent: 2em;";> D) String[] getParameterValues(String name) </p><p style="text-indent: 2em;";>(C) 60、使用GET方式提交数据、接收数据时,处理中文最直接有效方式是__。 </p><p style="text-indent: 2em;";> A) racterEncoding("utf-8"); </p><p style="text-indent: 2em;";> B) </p><p style="text-indent: 2em;";>tentType("text/html;charset=utf-8"); </p><p style="text-indent: 2em;";> C) String name= </p><p style="text-indent: 2em;";> new </p><p style="text-indent: 2em;";>String(ameter("name").getBytes("ISO-8859-1"),"gbk"); </p><p style="text-indent: 2em;";> D) racterEncoding("gbk"); </p><p style="text-indent: 2em;";>(A) 61、在文件上传时,用__对象接收文件。 </p><p style="text-indent: 2em;";> A) request </p><p style="text-indent: 2em;";> B) session </p><p style="text-indent: 2em;";> C) page </p><p style="text-indent: 2em;";> D) MultipartRequest </p><p style="text-indent: 2em;";>(B) 62、JSP页面程序片中可以使用__方法将strNumx=amter("ix")得到的数据类型转换为Double类型( )。 </p><p style="text-indent: 2em;";> A) tring(strNumx) </p><p style="text-indent: 2em;";> B) ouble(strNumx) </p><p style="text-indent: 2em;";> C) nteger(strNumx) </p><p style="text-indent: 2em;";> D) loat(strNumx) </p><p style="text-indent: 2em;";>(C) 63、JavaScript执行表单验证一般都发生在用户单击3 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>“提交”按钮后,数据提交服务器之前,onValidate()函数返回值为true时,__。 </p><p style="text-indent: 2em;";> A) 验证不通过,提交数据给服务器 </p><p style="text-indent: 2em;";> B) 验证不通过,不提交数据给服务器 </p><p style="text-indent: 2em;";> C) 验证通过,提交数据给服务器 </p><p style="text-indent: 2em;";> D) 验证通过,不提交数据给服务器 </p><p style="text-indent: 2em;";>(C) 64、对于<% String </p><p style="text-indent: 2em;";>(C) 71、用户需要在数据库添加数据行,使用__方法向服务器发送请求。 </p><p style="text-indent: 2em;";> A) get </p><p style="text-indent: 2em;";> B) post </p><p style="text-indent: 2em;";> C) method </p><p style="text-indent: 2em;";> D) 以上都不对 </p><p style="text-indent: 2em;";>(C) 72、在JSP页面中通过<jsp:forward page=urlname/>name=ribute("uname"); %>,使用__代码可以将name的值显示在页面。 </p><p style="text-indent: 2em;";> A) (name); </p><p style="text-indent: 2em;";> B) <% ().print(name)%> </p><p style="text-indent: 2em;";> C) <%=name%> </p><p style="text-indent: 2em;";> D) <p>name</p> </p><p style="text-indent: 2em;";>(A) 65、给定代码片断,如下: </p><p style="text-indent: 2em;";> <jsp:include page="" flush="false"> </p><p style="text-indent: 2em;";> <jsp:param name="color" value="red"/> </p><p style="text-indent: 2em;";> </jsp:include> </p><p style="text-indent: 2em;";> 要在中输出参数color中的值,以下__选项是正确的。 </p><p style="text-indent: 2em;";> A) <%=ameter("color")%> </p><p style="text-indent: 2em;";> B) <%=ribute("color")%> </p><p style="text-indent: 2em;";> C) <jsp:getParam name="color"/> </p><p style="text-indent: 2em;";> D) <jsp:include param="color"/> </p><p style="text-indent: 2em;";>(C) 66、考虑下面JSP文件代码片断: </p><p style="text-indent: 2em;";> <HTML> <BODY> </p><p style="text-indent: 2em;";> <jsp:include page=""> </p><p style="text-indent: 2em;";> <jsp:param name="username" value="svse"/> </p><p style="text-indent: 2em;";> </jsp:include> </p><p style="text-indent: 2em;";> </BODY> </HTML> </p><p style="text-indent: 2em;";> 以下__代码片断放置在中不会导致错误。 </p><p style="text-indent: 2em;";> A) <jsp:getParam name="username"/> </p><p style="text-indent: 2em;";> B) <jsp:include param ="username"/> </p><p style="text-indent: 2em;";> C) <%=ameter("username")%> </p><p style="text-indent: 2em;";> D) <%=ribute("username")%> </p><p style="text-indent: 2em;";>(A) 67、以下__可用于检索session属性userid的值。 </p><p style="text-indent: 2em;";> A) session. getAttribute ("userid"); </p><p style="text-indent: 2em;";> B) session. setAttribute ("userid"); </p><p style="text-indent: 2em;";> C) request. getParameter ("userid"); </p><p style="text-indent: 2em;";> D) request. getAttribute ("userid"); </p><p style="text-indent: 2em;";>(A) 68、只能够传递字符串类型数据的方式是__。 </p><p style="text-indent: 2em;";> A) 表单 URL重写 </p><p style="text-indent: 2em;";> B) session对象 表单 </p><p style="text-indent: 2em;";> C) 隐藏域 setParameter方法 </p><p style="text-indent: 2em;";> D) 都可以 </p><p style="text-indent: 2em;";>(A) 69、某JSP中有如下代码: </p><p style="text-indent: 2em;";> <% ribute("a","page"); </p><p style="text-indent: 2em;";> ribute("a", "request"); </p><p style="text-indent: 2em;";> ribute("a","session"); </p><p style="text-indent: 2em;";> ribute("a","application"); %> </p><p style="text-indent: 2em;";> 有:${a} </p><p style="text-indent: 2em;";> 则显示结果为:__。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) request </p><p style="text-indent: 2em;";> C) session </p><p style="text-indent: 2em;";> D) application </p><p style="text-indent: 2em;";>(B) 70、在HTTP协议中,用于发送大量数据的方法是__。 </p><p style="text-indent: 2em;";> A) get </p><p style="text-indent: 2em;";> B) post </p><p style="text-indent: 2em;";> C) put </p><p style="text-indent: 2em;";> D) options </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>将本页面请求转发至指定URL指定的文件,则在该URL组件(JSP页面)中,除了__范围,其余均可接收数据。 </p><p style="text-indent: 2em;";> A) session </p><p style="text-indent: 2em;";> B) request </p><p style="text-indent: 2em;";> C) page </p><p style="text-indent: 2em;";> D) application </p><p style="text-indent: 2em;";>(A) 73、<jsp:param>动作元素经常与__元素一起使用。 </p><p style="text-indent: 2em;";> A) <jsp:include> </p><p style="text-indent: 2em;";> B) <jsp:useBean> </p><p style="text-indent: 2em;";> C) <jsp:setProperty> </p><p style="text-indent: 2em;";> D) <jsp:import> </p><p style="text-indent: 2em;";>(C) 74、jsp指令不包括__指令。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) taglib </p><p style="text-indent: 2em;";> C) import </p><p style="text-indent: 2em;";> D) include </p><p style="text-indent: 2em;";>(B) 75、下面__不属于jsp动作标记。 </p><p style="text-indent: 2em;";> A) <jsp:attribute/> </p><p style="text-indent: 2em;";> B) <jsp:forwards/> </p><p style="text-indent: 2em;";> C) <jsp:include/> </p><p style="text-indent: 2em;";> D) <jsp:useBean/> </p><p style="text-indent: 2em;";>(D) 76、下列__不属于JSP动作指令标记。 </p><p style="text-indent: 2em;";> A) <jsp:param> </p><p style="text-indent: 2em;";> B) <jsp:plugin> </p><p style="text-indent: 2em;";> C) <jsp:useBean> </p><p style="text-indent: 2em;";> D) <jsp:javaBean> </p><p style="text-indent: 2em;";>(D) 77、在JSP中可动态导入其他页面的标签是__。 </p><p style="text-indent: 2em;";> A) <% include/></textarea> </p><p style="text-indent: 2em;";> B) <%@ include%> </p><p style="text-indent: 2em;";> C) <jsp:importPage/> </p><p style="text-indent: 2em;";> D) <jsp:include/> </p><p style="text-indent: 2em;";>(A) 78、在JSP中如果要导入.*包,应该使用__指令。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) taglib </p><p style="text-indent: 2em;";> C) include </p><p style="text-indent: 2em;";> D) forward </p><p style="text-indent: 2em;";>(B) 79、如果当前JSP页面不能显示中文,需要设置page指令的__属性。 </p><p style="text-indent: 2em;";> A) Exception </p><p style="text-indent: 2em;";> B) contentType </p><p style="text-indent: 2em;";> C) error </p><p style="text-indent: 2em;";> D) errorPage </p><p style="text-indent: 2em;";>(B) 80、要设置某个JSP页面为错误处理页面,以下page指令正确的是__。 </p><p style="text-indent: 2em;";> A) <%@ page errorPage="true"%> </p><p style="text-indent: 2em;";> B) <%@ page isErrorPage="true"%> </p><p style="text-indent: 2em;";> C) <%@ page </p><p style="text-indent: 2em;";>extends="orPage"%> </p><p style="text-indent: 2em;";> D) <%@ page info="error"%> </p><p style="text-indent: 2em;";>(A) 81、在中包含数行代码与一张图片,现在要创建一个,每次浏览时都能够以最快的速度显示中的所有内容以及自身要显示的4 </p><p style="text-indent: 2em;";>内容,应该在中使用的语句是__。 </p><p style="text-indent: 2em;";> A) <%@include file=""%> </p><p style="text-indent: 2em;";> B) <%@include page="" flush="true"> </p><p style="text-indent: 2em;";> C) <jsp:include file="" flush="false"> </p><p style="text-indent: 2em;";> D) <jsp:forward page=""/> </p><p style="text-indent: 2em;";>(D) 82、Page指令用于定义JSP文件中的全局属性,下列关于该指令用法的描述不正确的是__。 </p><p style="text-indent: 2em;";> A) <%@ page %>作用于整个JSP页面。 </p><p style="text-indent: 2em;";> B) 可以在一个页面中使用多个<%@ page %>指令。 </p><p style="text-indent: 2em;";> C) 为增强程序的可读性,建议将<%@ page %>指令放在JSP文件的开头,但不是必须的。 </p><p style="text-indent: 2em;";> D) <%@ page %>指令中的属性只能出现一次。 </p><p style="text-indent: 2em;";>(C) 83、JSP中有三大类标签,分别是__。 </p><p style="text-indent: 2em;";> A) HTML标记 JSP标记 Servlet标记 </p><p style="text-indent: 2em;";> B) CSS标记 HTML标记 Javascript标记 </p><p style="text-indent: 2em;";> C) 动作标记 脚本标记 指令标记 </p><p style="text-indent: 2em;";> D) 指令标记 脚本标记 HTML标记 </p><p style="text-indent: 2em;";>(A) 84、在JSP中,__动作用于将请求转发给其他JSP页面。 </p><p style="text-indent: 2em;";> A) forward </p><p style="text-indent: 2em;";> B) include </p><p style="text-indent: 2em;";> C) useBean </p><p style="text-indent: 2em;";> D) setProperty </p><p style="text-indent: 2em;";>(D) 85、可以执行请求转发的操作是__。 </p><p style="text-indent: 2em;";> A) jsp中response内置对象的sendRedirect()方法 </p><p style="text-indent: 2em;";> B) <jsp:include>标记 </p><p style="text-indent: 2em;";> C) RequestDispatcher对象的include()方法 </p><p style="text-indent: 2em;";> D) RequestDispatcher对象的forward()方法 </p><p style="text-indent: 2em;";>(D) 86、__内置对象可以处理jsp页面运行中的错误或者异常。 </p><p style="text-indent: 2em;";> A) pageContext </p><p style="text-indent: 2em;";> B) page </p><p style="text-indent: 2em;";> C) session </p><p style="text-indent: 2em;";> D) exception </p><p style="text-indent: 2em;";>(C) 87、session对象的__方法用于设置会话的超时时间。 </p><p style="text-indent: 2em;";> A) InactiveInterval(30); </p><p style="text-indent: 2em;";> B) Time(30); </p><p style="text-indent: 2em;";> C) InactiveInterval(); </p><p style="text-indent: 2em;";> D) ribute("time",30); </p><p style="text-indent: 2em;";>(C) 88、以下__陈述是错误的。 </p><p style="text-indent: 2em;";> A) 在WEB项目的共享数据范围内,application是范围最广泛的 </p><p style="text-indent: 2em;";> B) 当我们在一个JSP页面新开窗口时,新开窗口的页面也共享session范围内的数据 </p><p style="text-indent: 2em;";> C) 当在JSP页面中通过<jsp:forward>指令将页面请求转发到的页面中,可以共享一个page范围内的数据 </p><p style="text-indent: 2em;";> D) 当用户重新打开一个浏览器窗口时,原session对象不再有效 </p><p style="text-indent: 2em;";>(C) 89、在J2EE中,在中,有如下代码: </p><p style="text-indent: 2em;";> <session - config> </p><p style="text-indent: 2em;";> <session - timeout>30</session - timeout> </p><p style="text-indent: 2em;";> </session - config> </p><p style="text-indent: 2em;";> 上述代码定义了默认的会话超时时长,时长为30__。 </p><p style="text-indent: 2em;";> A) 毫秒 </p><p style="text-indent: 2em;";> B) 秒 </p><p style="text-indent: 2em;";> C) 分钟 </p><p style="text-indent: 2em;";> D) 小时 </p><p style="text-indent: 2em;";>(C) 90、在J2EE中,重定向到另一个页面,以下__语句是正确的。 </p><p style="text-indent: 2em;";> A) direct(""); </p><p style="text-indent: 2em;";> B) direct(); </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> C) direct(""); </p><p style="text-indent: 2em;";> D) direct(); </p><p style="text-indent: 2em;";>(A) 91、重向可以使用__方法。 </p><p style="text-indent: 2em;";> A) direct(""); </p><p style="text-indent: 2em;";> B) direct(""); </p><p style="text-indent: 2em;";> C) <jsp :forward page=""/> </p><p style="text-indent: 2em;";> D) <forward page=""/> </p><p style="text-indent: 2em;";>(D) 92、能够保留请求作用域中数据的转向方式是__。 </p><p style="text-indent: 2em;";> A) d() </p><p style="text-indent: 2em;";> B) direct() </p><p style="text-indent: 2em;";> C) </p><p style="text-indent: 2em;";>uestDispatcher().forward(request,response) </p><p style="text-indent: 2em;";> D) </p><p style="text-indent: 2em;";>uestDispatcher().forward(request,response) </p><p style="text-indent: 2em;";>(D) 93、给定一个JSP程序源代码如下: </p><p style="text-indent: 2em;";> <jsp:include page="" flush="true"> </p><p style="text-indent: 2em;";> <jsp:param name="location" value="bejing"/> </p><p style="text-indent: 2em;";> </jsp:include> </p><p style="text-indent: 2em;";> 在中使用__代码片段可以输出参数location的值。 </p><p style="text-indent: 2em;";> A) <jsp:getParam name="location"> </p><p style="text-indent: 2em;";> B) <jsp:getParameter name="location"> </p><p style="text-indent: 2em;";> C) <%=ribute("location")%> </p><p style="text-indent: 2em;";> D) <%=ameter("location")%> </p><p style="text-indent: 2em;";>(A) 94、JSP的编译指令标记通常是指__。 </p><p style="text-indent: 2em;";> A) Page指令、Include指令和Taglib指令 </p><p style="text-indent: 2em;";> B) Page指令、Include指令和Plugin指令 </p><p style="text-indent: 2em;";> C) Forward指令、Include指令和Taglib指令 </p><p style="text-indent: 2em;";> D) Page指令、Param指令和Taglib指令 </p><p style="text-indent: 2em;";>(B) 95、下列__指令定义在JSP编译时包含所需要的资源。 </p><p style="text-indent: 2em;";> A) include </p><p style="text-indent: 2em;";> B) page </p><p style="text-indent: 2em;";> C) taglib </p><p style="text-indent: 2em;";> D) forward </p><p style="text-indent: 2em;";>(B) 96、给定文件代码片断,如下: </p><p style="text-indent: 2em;";> <% ribute("User","HAHA");%> </p><p style="text-indent: 2em;";> __ //此处填写代码 </p><p style="text-indent: 2em;";> 给定文件代码片断,如下: </p><p style="text-indent: 2em;";> <%=ribute("User")%> </p><p style="text-indent: 2em;";> 要求运行时,浏览器上输出:HAHA </p><p style="text-indent: 2em;";> 要满足以上条件,中下划线处应填入以下__语句。 </p><p style="text-indent: 2em;";> A) <jsp:include page="" </p><p style="text-indent: 2em;";>flush="true"/> null </p><p style="text-indent: 2em;";> B) <%@ include file=""%> HAHA </p><p style="text-indent: 2em;";> C) <jsp:forward page=""/> null </p><p style="text-indent: 2em;";> D) <% direct("");%> </p><p style="text-indent: 2em;";>null </p><p style="text-indent: 2em;";>(B) 97、在JSP页面中,类型为HttpServletResponse的内置对象是__。 </p><p style="text-indent: 2em;";> A) out </p><p style="text-indent: 2em;";> B) response </p><p style="text-indent: 2em;";> C) request </p><p style="text-indent: 2em;";> D) config </p><p style="text-indent: 2em;";>(B) 98、__标记指定访问servlet的路径。 </p><p style="text-indent: 2em;";> A) <servlet-name> </p><p style="text-indent: 2em;";> B) <servlet-class> </p><p style="text-indent: 2em;";> C) <url-pattern> </p><p style="text-indent: 2em;";>5 </p><p style="text-indent: 2em;";> D) <context-param> </p><p style="text-indent: 2em;";>(B) 99、下列__类是抽象类。 </p><p style="text-indent: 2em;";> A) ServletConfig </p><p style="text-indent: 2em;";> B) HttpServlet </p><p style="text-indent: 2em;";> C) Cookie </p><p style="text-indent: 2em;";> D) HttpServletRequest </p><p style="text-indent: 2em;";>(B) 100、完整的配置一个Servlet需要__标签。 </p><p style="text-indent: 2em;";> A) <webapp></webapp> </p><p style="text-indent: 2em;";> B) <servlet></servlet>和<servlet-mapping></servlet-mapping> </p><p style="text-indent: 2em;";> C) <servlet-name/>和<servlet-class> </p><p style="text-indent: 2em;";> D) <servlet-mapping><servlet-name> </p><p style="text-indent: 2em;";>(B) 101、JSP页面经过编译之后,将创建一个__。 </p><p style="text-indent: 2em;";> A) applet </p><p style="text-indent: 2em;";> B) servlet </p><p style="text-indent: 2em;";> C) application </p><p style="text-indent: 2em;";> D) exe文件 </p><p style="text-indent: 2em;";>(A) 102、Servlet程序的入口点是__。 </p><p style="text-indent: 2em;";> A) init() </p><p style="text-indent: 2em;";> B) main() </p><p style="text-indent: 2em;";> C) service() </p><p style="text-indent: 2em;";> D) doGet() </p><p style="text-indent: 2em;";>(C) 103、Servlet的初始化参数只能在Servlet的__方法中获取。 </p><p style="text-indent: 2em;";> A) doPost() </p><p style="text-indent: 2em;";> B) doGet() </p><p style="text-indent: 2em;";> C) init() </p><p style="text-indent: 2em;";> D) destroy() </p><p style="text-indent: 2em;";>(C) 104、在编写Servlet时需要__。 </p><p style="text-indent: 2em;";> A) 继承Servlet </p><p style="text-indent: 2em;";> B) 实现HttpRequestServlet </p><p style="text-indent: 2em;";> C) 继承HttpServlet </p><p style="text-indent: 2em;";> D) 实现HttpRequest </p><p style="text-indent: 2em;";>(A) 105、给定一个Servlet的代码片段如下: </p><p style="text-indent: 2em;";> Public void doGet(HttpServletRequest </p><p style="text-indent: 2em;";>request,HttpServletResponse response) </p><p style="text-indent: 2em;";> throws ServletException,IOException{ </p><p style="text-indent: 2em;";> ______ </p><p style="text-indent: 2em;";> n("hi kitty! "); </p><p style="text-indent: 2em;";> (); } </p><p style="text-indent: 2em;";> 运行次Servlet时输出:hi kitty! </p><p style="text-indent: 2em;";> 则应在此Servlet下划线处填充如下代码。 </p><p style="text-indent: 2em;";> A) PrintWriter out = ter(); </p><p style="text-indent: 2em;";> B) PrintWriter out = ter(); </p><p style="text-indent: 2em;";> C) OutputStream out = putStream(); </p><p style="text-indent: 2em;";> D) OutputStream out = ter(); </p><p style="text-indent: 2em;";>(A) 106、编写Servlet 的doPost方法时,需要抛出异常是__。 </p><p style="text-indent: 2em;";> A) ServletException, IOException </p><p style="text-indent: 2em;";> B) ServletException, RemoteException </p><p style="text-indent: 2em;";> C) HttpServletException, IOException </p><p style="text-indent: 2em;";> D) HttpServletException, RemoteException </p><p style="text-indent: 2em;";>(A) 107、在Servlet里,能正确获取session的语句是__。 </p><p style="text-indent: 2em;";> A) HttpSession session=sion(true); </p><p style="text-indent: 2em;";> B) HttpSession </p><p style="text-indent: 2em;";>session=pSession(true); </p><p style="text-indent: 2em;";> C) HttpSession </p><p style="text-indent: 2em;";>session=sion(true); </p><p style="text-indent: 2em;";> D) HttpSession session=response. getHttpSession </p><p style="text-indent: 2em;";>(true); </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>(B) 108、给定一个Servlet程序的代码片段,如下: </p><p style="text-indent: 2em;";>Public void doPost(HttpServletRequest </p><p style="text-indent: 2em;";>request,HttpServletResponse response) throws </p><p style="text-indent: 2em;";>ServletException { </p><p style="text-indent: 2em;";> sion().getAttribute("A"); //第二行 </p><p style="text-indent: 2em;";>} </p><p style="text-indent: 2em;";>假定第二行返回的对象引用不是null,那么这个对象存储在__范围中。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) session </p><p style="text-indent: 2em;";> C) request </p><p style="text-indent: 2em;";> D) application </p><p style="text-indent: 2em;";>(C) 109、Servlet中,HttpServletResponse的__方法用来把一个Http请求重定向到另外的URL。 </p><p style="text-indent: 2em;";> A) sendURL() </p><p style="text-indent: 2em;";> B) redirectURL() </p><p style="text-indent: 2em;";> C) sendRedirect() </p><p style="text-indent: 2em;";> D) redirectResponse() </p><p style="text-indent: 2em;";>(D) 110、在Servlet中有一段代码如下 </p><p style="text-indent: 2em;";> public void doPost(HttpServletRequest request, </p><p style="text-indent: 2em;";>HttpServletResponse response) </p><p style="text-indent: 2em;";> throws ServletException, IOException { </p><p style="text-indent: 2em;";> ribute("name", new Integer(100)); </p><p style="text-indent: 2em;";> direct(""); </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";> 在中 </p><p style="text-indent: 2em;";> <%=ribute("name")%> </p><p style="text-indent: 2em;";> 页面结果为__。 </p><p style="text-indent: 2em;";> A) 100 </p><p style="text-indent: 2em;";> B) r </p><p style="text-indent: 2em;";> C) Integer </p><p style="text-indent: 2em;";> D) null </p><p style="text-indent: 2em;";>(A) 111、请求Servlet的时候,Servlet的对象由__。 </p><p style="text-indent: 2em;";> A) 服务器负责实例化 </p><p style="text-indent: 2em;";> B) 由开发人员在请求中实例化 </p><p style="text-indent: 2em;";> C) Servlet会自动实例化 </p><p style="text-indent: 2em;";> D) Servlet只加载,无需实例化 </p><p style="text-indent: 2em;";>(C) 112、Servlet的运行过程是__。 </p><p style="text-indent: 2em;";> A) 当请求Servlet时,服务器会即时加载Servlet类,然后对该类进行实例化,调用相应的方法处理请求 </p><p style="text-indent: 2em;";> B) 首先对Servlet 进行配置,然后服务器在处理请求时,将配置过的Servlet类找到,然后实例化处理请求 </p><p style="text-indent: 2em;";> C) 在服务器启动时,会加载Servlet,然后在处理请求的时候,实例化Servlet对象处理请求 </p><p style="text-indent: 2em;";> D) Servlet是一个具有接受请求和响应功能的类,在被请求时,Servlet早就被实例化好了,可以直接处理请求 </p><p style="text-indent: 2em;";>(A) 113、Servlet 接受请求时,会调用__。 </p><p style="text-indent: 2em;";> A) service </p><p style="text-indent: 2em;";> B) doGet </p><p style="text-indent: 2em;";> C) doPost </p><p style="text-indent: 2em;";> D) init </p><p style="text-indent: 2em;";>(A) 114、下面Servlet的__方法用来为请求服务,在Servlet生命周期中,Servlet每被请求一次它就会被调用一次。 </p><p style="text-indent: 2em;";> A) service() </p><p style="text-indent: 2em;";> B) init() </p><p style="text-indent: 2em;";> C) doPost() </p><p style="text-indent: 2em;";> D) destroy() </p><p style="text-indent: 2em;";>(A) 115、有关servlet的生命周期说法错误的是__。 </p><p style="text-indent: 2em;";>6 </p><p style="text-indent: 2em;";> A) servlet的生命周期由servlet实例控制 </p><p style="text-indent: 2em;";> B) init()方法在创建完servlet实例后对其进行初始化,传递的参数为实现servletContext借口的对象 </p><p style="text-indent: 2em;";> C) service()方法响应客户端的请求 </p><p style="text-indent: 2em;";> D) destroy()方法释放servlet实例 </p><p style="text-indent: 2em;";>(B) 116、阅读下面代码片段: </p><p style="text-indent: 2em;";> RequestDispatcher </p><p style="text-indent: 2em;";>dispatcher=uestDispatcher(""); </p><p style="text-indent: 2em;";> d(request,response); </p><p style="text-indent: 2em;";> 关于该段代码的作用,下列__叙述是正确的。 </p><p style="text-indent: 2em;";> A) 页面重定向到页面 </p><p style="text-indent: 2em;";> B) 将请求转发到页面 </p><p style="text-indent: 2em;";> C) 从定向到当前页面 </p><p style="text-indent: 2em;";> D) 从转发到当前页面 </p><p style="text-indent: 2em;";>(B) 117、一个servlet的生命周期不包括__方法。 </p><p style="text-indent: 2em;";> A) init() </p><p style="text-indent: 2em;";> B) invalidate() </p><p style="text-indent: 2em;";> C) service() </p><p style="text-indent: 2em;";> D) destroy() </p><p style="text-indent: 2em;";>(C) 118、在Servlet过滤器的生命周期方法中,每当传递请求或响应时,web容器会调用__方法。 </p><p style="text-indent: 2em;";> A) init </p><p style="text-indent: 2em;";> B) service </p><p style="text-indent: 2em;";> C) doFilter </p><p style="text-indent: 2em;";> D) destroy </p><p style="text-indent: 2em;";>(D) 119、下面对servlet中重定向说法描述错误的是__。 </p><p style="text-indent: 2em;";> A) 使用的是HttpServletResponse接口的sendRedirect()方法 </p><p style="text-indent: 2em;";> B) 源组件的响应结果不会发送给客户端 </p><p style="text-indent: 2em;";> C) sendRedirect()方法后的代码仍会执行 </p><p style="text-indent: 2em;";> D) 源组件和目标组件共享ServletRequest对象 </p><p style="text-indent: 2em;";>(C) 120、Servlet中,HttpServletResponse的__方法用来把一个Http请求重定向到另外的URL。 </p><p style="text-indent: 2em;";> A) sendURL() </p><p style="text-indent: 2em;";> B) redirectURL() </p><p style="text-indent: 2em;";> C) sendRedirect() </p><p style="text-indent: 2em;";> D) redirectResponse() </p><p style="text-indent: 2em;";>(C) 121、J2EE中,以下关于HttpServlet的说法错误的是__。 </p><p style="text-indent: 2em;";> A) HttpServlet是一个抽象类 </p><p style="text-indent: 2em;";> B) HttpServlet类扩展了GenericServlet类 </p><p style="text-indent: 2em;";> C) HttpServlet类的子类必须至少重写service方法 </p><p style="text-indent: 2em;";> D) HttpServlet位于包中 </p><p style="text-indent: 2em;";>(C) 122、下面__选项不是http响应的一部分。 </p><p style="text-indent: 2em;";> A) 响应头 </p><p style="text-indent: 2em;";> B) 响应正文 </p><p style="text-indent: 2em;";> C) 协议版本号 </p><p style="text-indent: 2em;";> D) 状态行 </p><p style="text-indent: 2em;";>(B) 123、在Servlet中,ter()返回的是__对象。 </p><p style="text-indent: 2em;";> A) JspWriter </p><p style="text-indent: 2em;";> B) PrintWriter </p><p style="text-indent: 2em;";> C) Out </p><p style="text-indent: 2em;";> D) ResponseWriter </p><p style="text-indent: 2em;";>(D) 124、在访问Servlet时,在浏览器地址栏中输入的路径是在__地方配置的。 </p><p style="text-indent: 2em;";> A) <servlet-name/> </p><p style="text-indent: 2em;";> B) <servlet-mapping/> </p><p style="text-indent: 2em;";> C) <uri-pattern/> </p><p style="text-indent: 2em;";> D) <url-pattern/> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>(D) 125、给定一个 Servlet 的doGet方法中的代码片段,如下: </p><p style="text-indent: 2em;";> ribute("name","zhang"); </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>direct("localhost:8080/servlet/MyServlt"); </p><p style="text-indent: 2em;";> 那么在 MyServlet 中可以使用__方法把属性 name的值取出来。 </p><p style="text-indent: 2em;";> A) String str=ribute("name"); </p><p style="text-indent: 2em;";> B) String </p><p style="text-indent: 2em;";>str=(String)ribute("name"); </p><p style="text-indent: 2em;";> C) Object str=ribute("name"); </p><p style="text-indent: 2em;";> D) 无法取出来 </p><p style="text-indent: 2em;";>(C) 126、在Servlet中,下列语句可以正确获取PrintWriter对象的是__。 </p><p style="text-indent: 2em;";> A) PrintWriter out=ter(); </p><p style="text-indent: 2em;";> B) PrintWriter out=ntWriter(); </p><p style="text-indent: 2em;";> C) PrintWriter out= ter(); </p><p style="text-indent: 2em;";> D) PrintWriter out=ntWriter(); </p><p style="text-indent: 2em;";>(D) 127、当一个Servlet首次被请求的时候,服务器首先会调用__方法。 </p><p style="text-indent: 2em;";> A) doGet </p><p style="text-indent: 2em;";> B) doPost </p><p style="text-indent: 2em;";> C) doInit </p><p style="text-indent: 2em;";> D) init </p><p style="text-indent: 2em;";>(B) 128、下面Servlet的__方法载入时执行,且只执行一次,负责对Servlet进行初始化。 </p><p style="text-indent: 2em;";> A) service() </p><p style="text-indent: 2em;";> B)init() </p><p style="text-indent: 2em;";> C)doPost() </p><p style="text-indent: 2em;";> D)destroy() </p><p style="text-indent: 2em;";>(C) 129、对于ServletRequest接口的获取请求参数的方法的描述__是正确的。 </p><p style="text-indent: 2em;";> A) getParameter方法只用于接收POST请求参数,接收GET请求参数需要使用getQueryString方法 </p><p style="text-indent: 2em;";> B) 如果一个参数key有多个值,那么getParameter(key)方法会返回空 </p><p style="text-indent: 2em;";> C) 如果一个参数key有多个值,那么getParameterValues(key)方法会返回一个包含所有值的字符串数组 </p><p style="text-indent: 2em;";> D) getParameter方法返回Object对象,使用前要强制类型转换:如String str=(String) </p><p style="text-indent: 2em;";>ameter(key) </p><p style="text-indent: 2em;";>(B) 130、uestDispatcher().forward(request,response)称之为__。 </p><p style="text-indent: 2em;";> A) 流转 </p><p style="text-indent: 2em;";> B) 转发 </p><p style="text-indent: 2em;";> C) 重定向 </p><p style="text-indent: 2em;";> D) 导航 </p><p style="text-indent: 2em;";>(A) 131、给定一个Servlet的代码片段如下: </p><p style="text-indent: 2em;";> public void doGet(HttpServletRequest </p><p style="text-indent: 2em;";>request,HttpServletResponse response) </p><p style="text-indent: 2em;";> throws ServletException,IOException{ </p><p style="text-indent: 2em;";> __ </p><p style="text-indent: 2em;";> n("hi kitty!"); </p><p style="text-indent: 2em;";> (); } </p><p style="text-indent: 2em;";> 运行次Servlet时输出如下: </p><p style="text-indent: 2em;";> hi kitty! </p><p style="text-indent: 2em;";> 则应在此Servlet下划线处填充如下代码。 </p><p style="text-indent: 2em;";>7 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> A) PrintWriter out = ter(); </p><p style="text-indent: 2em;";> B) PrintWriter out = ter(); </p><p style="text-indent: 2em;";> C) OutputStream out = putStream(); </p><p style="text-indent: 2em;";> D) OutputStream out = ter(); </p><p style="text-indent: 2em;";>(C) 132、给定如下Servlet代码,当在浏览器中输入:localhost:8080/servlet/HelloServlet,可以调用这个servlet,那么这个Servlet的输出是__。 </p><p style="text-indent: 2em;";> import .*; </p><p style="text-indent: 2em;";> import t.*; </p><p style="text-indent: 2em;";> import .*; </p><p style="text-indent: 2em;";> public class HelloServlet extends HttpServlet{ </p><p style="text-indent: 2em;";> public void service(HttpServletRequest req, </p><p style="text-indent: 2em;";>(B) 136、一个典型的HTTP请求消息包括请求行、多个请求头和__。 </p><p style="text-indent: 2em;";> A) 响应行 </p><p style="text-indent: 2em;";> B) 信息体 </p><p style="text-indent: 2em;";> C) 信息头 </p><p style="text-indent: 2em;";> D) 响应头 </p><p style="text-indent: 2em;";>(B) 137、在JSP中,以下是有关<jsp:setProperty>和<jsp:getProperty>标记的描述,正确的是__。 </p><p style="text-indent: 2em;";> A) <jsp:setProperty>和<jsp:getProperty>标记都必须在<jsp:useBean>的开始标记和结束标记之间 </p><p style="text-indent: 2em;";> B) 这两个标记的name属性的值必须和<jsp:usebean>标记的id 属性的值相对应 </p><p style="text-indent: 2em;";>HttpServletResponse res) </p><p style="text-indent: 2em;";> throws ServletException, IOException{ </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";> public void doGet(HttpServletRequest req, </p><p style="text-indent: 2em;";>HttpServletResponse res) </p><p style="text-indent: 2em;";> throws ServletException, IOException { </p><p style="text-indent: 2em;";> tentType("text/html"); </p><p style="text-indent: 2em;";> PrintWriter out = ter(); </p><p style="text-indent: 2em;";> n("<html>"); </p><p style="text-indent: 2em;";> n("<body>"); </p><p style="text-indent: 2em;";> n("doGet Hello World!"); </p><p style="text-indent: 2em;";> n("</body>"); </p><p style="text-indent: 2em;";> n("</html>"); </p><p style="text-indent: 2em;";> (); </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";> public void doPost(HttpServletRequest req, </p><p style="text-indent: 2em;";>HttpServletResponse res) </p><p style="text-indent: 2em;";> throws ServletException, IOException { </p><p style="text-indent: 2em;";> tentType("text/html"); </p><p style="text-indent: 2em;";> PrintWriter out = ter(); </p><p style="text-indent: 2em;";> n("<html>"); </p><p style="text-indent: 2em;";> n("<body>"); </p><p style="text-indent: 2em;";> n("doPost Hello World!"); </p><p style="text-indent: 2em;";> n("</body>"); </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";> A) 一个HTML页面,页面上显示doGet Hello World! </p><p style="text-indent: 2em;";> B) 一个HTML页面,页面上显示doPost Hello World! </p><p style="text-indent: 2em;";> C) 一个空白的HTML页面 </p><p style="text-indent: 2em;";> D) 错误信息 </p><p style="text-indent: 2em;";>(D) 133、http请求及响应的正文部分可以是任意格式的数据,要保证接收方能看得懂发送方发送的数据,http协议采用__协议来规范正文的数据格式。 </p><p style="text-indent: 2em;";> A) FTP </p><p style="text-indent: 2em;";> B) TCP </p><p style="text-indent: 2em;";> C) HTTP </p><p style="text-indent: 2em;";> D) MIME </p><p style="text-indent: 2em;";>(C) 134、HttpServletRequest对象的__方法能够获取一个表单参数的值。 </p><p style="text-indent: 2em;";> A) getQuaryString() </p><p style="text-indent: 2em;";> B) getPathInfo() </p><p style="text-indent: 2em;";> C) getParameter() </p><p style="text-indent: 2em;";> D) getAttribute() </p><p style="text-indent: 2em;";>(B) 135、从HTTP请求中,获得请求参数,应该调用__。 </p><p style="text-indent: 2em;";> A) request对象的getAttribute()方法 </p><p style="text-indent: 2em;";> B) request对象的getParameter()方法 </p><p style="text-indent: 2em;";> C) session对象的getAttribute()方法 </p><p style="text-indent: 2em;";> D) session对象的getParameter()方法 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> C) <jsp:setProperty>和<jsp:getProperty> 标记可以用于对bean中定义的所有属性进行选择和设置 </p><p style="text-indent: 2em;";> D) 这两个标记的name属性的值可以和<jsp:userbean>标记的id属性的值不同 </p><p style="text-indent: 2em;";>(D) 138、JavaBean的作用域按从大到小排列正确的是__。 </p><p style="text-indent: 2em;";> A) application page request response </p><p style="text-indent: 2em;";> B) session page request application </p><p style="text-indent: 2em;";> C) public application session request </p><p style="text-indent: 2em;";> D) application session request page </p><p style="text-indent: 2em;";>(C) 139、在JSP中,使用<jsp:useBean>动作可以将javaBean嵌入JSP页面,对JavaBean的访问范围不能是__。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) request </p><p style="text-indent: 2em;";> C) response </p><p style="text-indent: 2em;";> D) application </p><p style="text-indent: 2em;";>(A) 140、关于JavaBean正确的说法是__。 </p><p style="text-indent: 2em;";> A) Java文件与Bean所定义的类名可以不同,但一定要注意区分字母的大小写 </p><p style="text-indent: 2em;";> B) 在JSP文件中引用Bean,其实就是用<jsp:useBean>语句 </p><p style="text-indent: 2em;";> C) 被引用的Bean文件的文件名后缀为.java </p><p style="text-indent: 2em;";> D) Bean文件放在任何目录下都可以被引用 </p><p style="text-indent: 2em;";>(C) 141、在J2EE中,文件中有如下一行代码: </p><p style="text-indent: 2em;";> <jsp:useBean id="user" scope="__" </p><p style="text-indent: 2em;";>type="an"/> </p><p style="text-indent: 2em;";> 要使user 对象中一直存在于对话中,直至其终止或被删除为止,下划线中应填入__。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) request </p><p style="text-indent: 2em;";> C) session </p><p style="text-indent: 2em;";> D) application </p><p style="text-indent: 2em;";> (D) 142、<jsp:useBean id="bean的名称" scope="bean的有效范围" class="包名.类名"/>动作标记中,scope的值不可以是__。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) request </p><p style="text-indent: 2em;";> C) session </p><p style="text-indent: 2em;";> D) response </p><p style="text-indent: 2em;";>(C) 143、给定TheBean类,假设还没有创建TheBean类的实例,以下JSP标准动作语句__能创建这个bean的一个新实例,并把它存储在请求作用域。 </p><p style="text-indent: 2em;";> A) <jsp :useBean name="myBean" </p><p style="text-indent: 2em;";>type="n"/> </p><p style="text-indent: 2em;";> B) <jsp :takeBean name="myBean" </p><p style="text-indent: 2em;";>type="n"/> </p><p style="text-indent: 2em;";> C) <jsp :useBean id="myBean" </p><p style="text-indent: 2em;";>class="n" scope="request"/> </p><p style="text-indent: 2em;";> D) <jsp :takeBean id="myBean" </p><p style="text-indent: 2em;";>8 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>class="n" scope="request"/> </p><p style="text-indent: 2em;";>(C) 144、在JSP页面中,__可以正确引入JavaBean。 </p><p style="text-indent: 2em;";> A) <%jsp: useBean id =”myBean” scope =”page” </p><p style="text-indent: 2em;";>class=”” %> </p><p style="text-indent: 2em;";> B) <jsp: useBean name =”myBean” scope =”page” </p><p style="text-indent: 2em;";>class=”” > </p><p style="text-indent: 2em;";> C) <jsp: useBean id =”myBean” scope =”page” </p><p style="text-indent: 2em;";>class=”” /> </p><p style="text-indent: 2em;";> D) <jsp: useBean name =”myBean” scope =”page” </p><p style="text-indent: 2em;";> D) 不确定 </p><p style="text-indent: 2em;";>(B) 153、在JSP页面中使用<jsp:setProperty name="bean的名字" property ="*" />格式,将表单参数为Bean属性赋值,property="*"格式要求Bean的属性名字__。 </p><p style="text-indent: 2em;";> A) 必须和表单参数类型一致 </p><p style="text-indent: 2em;";> B) 必须和表单参数名称一一对应 </p><p style="text-indent: 2em;";> C) 必须和表单参数数量一致 </p><p style="text-indent: 2em;";> D) 名称不一定对应 </p><p style="text-indent: 2em;";>(D) 154、文件中有如下一行代码: </p><p style="text-indent: 2em;";>class=”” /> </p><p style="text-indent: 2em;";>(D) 145、JavaBean的scope取值__可使该javabean被多个用户共享,即和web应用有相同的生命周期。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) request </p><p style="text-indent: 2em;";> C) session </p><p style="text-indent: 2em;";> D) application </p><p style="text-indent: 2em;";>(B) 146、下面__不是JSP中和javabean相关的标记。 </p><p style="text-indent: 2em;";> A) <jsp:userBean> </p><p style="text-indent: 2em;";> B) <jsp:include> </p><p style="text-indent: 2em;";> C) <jsp:setProperty> </p><p style="text-indent: 2em;";> D) <jsp:getProperty> </p><p style="text-indent: 2em;";>(D) 147、JavaBean可以通过相关jsp动作指令进行调用。下面__不是JavaBean可以使用的jsp动作指令。 </p><p style="text-indent: 2em;";> A) <jsp:useBean> </p><p style="text-indent: 2em;";> B) <jsp:setProperty> </p><p style="text-indent: 2em;";> C) <jsp:getProperty> </p><p style="text-indent: 2em;";> D) <jsp:setParameter> </p><p style="text-indent: 2em;";>(A) 148、JavaBean的作用范围可以取值page、request、session和__。 </p><p style="text-indent: 2em;";> A) application </p><p style="text-indent: 2em;";> B) local </p><p style="text-indent: 2em;";> C) global </p><p style="text-indent: 2em;";> D) class </p><p style="text-indent: 2em;";>(D) 149、下面__是错误的设置Bean属性值的方法。 </p><p style="text-indent: 2em;";> A) <jsp:setProperty name="B" property= "*" /> </p><p style="text-indent: 2em;";> B) <jsp:setProperty name="B" </p><p style="text-indent: 2em;";>property="propertyName" value="123"/> </p><p style="text-indent: 2em;";> C) <jsp:setProperty name="B" </p><p style="text-indent: 2em;";>property="propertyName" param="parameterName" /> </p><p style="text-indent: 2em;";> D) <jsp:setProperty name="B" property="*" </p><p style="text-indent: 2em;";>value="{string | <%= expression %>}"/> </p><p style="text-indent: 2em;";>(C) 150、JSP页面通过__来识别Bean对象,可以在程序片中通过形式来调用Bean中的set和get方法。 </p><p style="text-indent: 2em;";> A) name </p><p style="text-indent: 2em;";> B) class </p><p style="text-indent: 2em;";> C) id </p><p style="text-indent: 2em;";> D) classname </p><p style="text-indent: 2em;";>(B) 151、使用<jsp:setProperty>动作标记可以在JSP页面中设置Bean的属性,但必须保证Bean有对应的__方法。 </p><p style="text-indent: 2em;";> A) SetXxx </p><p style="text-indent: 2em;";> B) setXxx </p><p style="text-indent: 2em;";> C) getXxx </p><p style="text-indent: 2em;";> D) GetXxx </p><p style="text-indent: 2em;";>(A) 152、在JSP页面中使用<jsp:setProperty </p><p style="text-indent: 2em;";>name="beanid" property="bean的属性" value="字符串" </p><p style="text-indent: 2em;";>/>格式给Long类型的Bean属性赋值,会调用__数据类型转换方法。 </p><p style="text-indent: 2em;";> A) ong(String s) </p><p style="text-indent: 2em;";> B) nt(Stirng s) </p><p style="text-indent: 2em;";> C) ouble(String s) </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";><jsp:useBean id="user" scope="__" </p><p style="text-indent: 2em;";>class="an"> </p><p style="text-indent: 2em;";>要使user对象可以作用于整个应用程序,下划线中应添入__。 </p><p style="text-indent: 2em;";> A) page </p><p style="text-indent: 2em;";> B) request </p><p style="text-indent: 2em;";> C) session </p><p style="text-indent: 2em;";> D) application </p><p style="text-indent: 2em;";>(C) 155、下面关于JSP作用域对象的说法错误的是__。 </p><p style="text-indent: 2em;";> A) request对象可以得到请求中的参数 </p><p style="text-indent: 2em;";> B) session对象可以保存用户信息 </p><p style="text-indent: 2em;";> C) application对象可以被多个应用共享 </p><p style="text-indent: 2em;";> D) 作用域范围从小到大是request、session、application </p><p style="text-indent: 2em;";>(C) 156、下列__作用范围的Bean,当客户离开这个页面时,JSP引擎取消为客户该页面分配的Bean,释放他所占的内存空间。 </p><p style="text-indent: 2em;";> A) application </p><p style="text-indent: 2em;";> B) request </p><p style="text-indent: 2em;";> C) page </p><p style="text-indent: 2em;";> D) session </p><p style="text-indent: 2em;";>(A) 157、使用<jsp:getProperty>动作标记可以在JSP页面中得到Bean实例的属性值,并将其转换为__类型的数据,发送到客户端。 </p><p style="text-indent: 2em;";> A) String </p><p style="text-indent: 2em;";> B) Double </p><p style="text-indent: 2em;";> C) Object </p><p style="text-indent: 2em;";> D) Classes </p><p style="text-indent: 2em;";>(A) 158、使用格式<jsp:setProperty name="beanid" </p><p style="text-indent: 2em;";>property="bean的属性" value = "<%= expression %>" />给Bean的属性赋值,expression的数据类型和bean的属性类型__。 </p><p style="text-indent: 2em;";> A) 必须一致 </p><p style="text-indent: 2em;";> B) 可以不一致 </p><p style="text-indent: 2em;";> C) 必须不同 </p><p style="text-indent: 2em;";> D) 无要求 </p><p style="text-indent: 2em;";>(A) 159、关于JavaBean正确的说法是__。 </p><p style="text-indent: 2em;";> A) Java文件与Bean所定义的类名可以不同,但一定要注意区分字母的大小写。 </p><p style="text-indent: 2em;";> B) 在JSP文件中引用Bean,其实就是用<jsp:useBean>语句。 </p><p style="text-indent: 2em;";> C) 被引用的Bean文件的文件名后缀为.java。 </p><p style="text-indent: 2em;";> D) Bean文件放在任何目录下都可以被引用。 </p><p style="text-indent: 2em;";>(A) 160、localhost:8080/web/?name=aaa下列__可以正确取得请求参数值。 </p><p style="text-indent: 2em;";> A) {} </p><p style="text-indent: 2em;";> B) {name} </p><p style="text-indent: 2em;";> C) {} </p><p style="text-indent: 2em;";> D) {("name")} </p><p style="text-indent: 2em;";>(B) 161、JSTL包含的各种标签可用于__页面中。 </p><p style="text-indent: 2em;";> A) html </p><p style="text-indent: 2em;";>9 </p><p style="text-indent: 2em;";> B) jsp </p><p style="text-indent: 2em;";> C) xml </p><p style="text-indent: 2em;";> D) asp </p><p style="text-indent: 2em;";>(D) 162、自定义标签的配置文件放在__。 </p><p style="text-indent: 2em;";> A) WebRoot </p><p style="text-indent: 2em;";> B) lib </p><p style="text-indent: 2em;";> C) classes </p><p style="text-indent: 2em;";> D) WEB-INF </p><p style="text-indent: 2em;";>(B) 163、JSP的__指令允许页面使用者自定义标签库。 </p><p style="text-indent: 2em;";> A) Include指令 </p><p style="text-indent: 2em;";> B) Taglib指令 </p><p style="text-indent: 2em;";> C) Include指令 </p><p style="text-indent: 2em;";> D) Plugin指令 </p><p style="text-indent: 2em;";>(C) 164、自定义标签的作用是__。 </p><p style="text-indent: 2em;";> A) 编写和使用方便 </p><p style="text-indent: 2em;";> B) 规定是这样的,如果不用,别人会说我们不专业 </p><p style="text-indent: 2em;";> C) 可以减少jsp中的java代码,将代码与界面标签分离,简化前台开发 </p><p style="text-indent: 2em;";> D) 连数据库 </p><p style="text-indent: 2em;";>(A) 165、在J2EE中,标签库中文件(*.tld)存放在__目录下的。 </p><p style="text-indent: 2em;";> A) WEB—INF </p><p style="text-indent: 2em;";> B) WEB—INF/tags </p><p style="text-indent: 2em;";> C) WEB—INF/classes </p><p style="text-indent: 2em;";> D) WEB—INF/lib </p><p style="text-indent: 2em;";>(D) 166、核心标签库中,用来实现循环功能的标签是__。 </p><p style="text-indent: 2em;";> A) <c:if> </p><p style="text-indent: 2em;";> B) <c:for> </p><p style="text-indent: 2em;";> C) <c:while> </p><p style="text-indent: 2em;";> D) <c:forEach> </p><p style="text-indent: 2em;";>(B) 167、JSTL中相当于<jsp:include >标准动作的标签是__。 </p><p style="text-indent: 2em;";> A) <c:url> </p><p style="text-indent: 2em;";> B) <c:import> </p><p style="text-indent: 2em;";> C) <c:redirect> </p><p style="text-indent: 2em;";> D) <c:set> </p><p style="text-indent: 2em;";>(B) 168、在过滤器链中,最先截取客户请求的过滤器将__才能截取Servlet响应信息。 </p><p style="text-indent: 2em;";> A) 最先 </p><p style="text-indent: 2em;";> B) 最后 </p><p style="text-indent: 2em;";> C) 按优先级 </p><p style="text-indent: 2em;";> D) 以上都不对 </p><p style="text-indent: 2em;";>(C) 169、使用 Resultset对象的 next()方法移动光标时,如果超过界限,会抛出异常,该异常通常是__。 </p><p style="text-indent: 2em;";> A) InterruptedException </p><p style="text-indent: 2em;";> B) AlreadyBoundException </p><p style="text-indent: 2em;";> C) SQLException </p><p style="text-indent: 2em;";> D) NetException </p><p style="text-indent: 2em;";>(D) 170、下面关于MVC的说法不正确的是__。 </p><p style="text-indent: 2em;";> A) M表示Model层,是存储数据的地方 </p><p style="text-indent: 2em;";> B) View表示视图层,负责向用户显示外观 </p><p style="text-indent: 2em;";> C) Controller是控制层,负责控制流程 </p><p style="text-indent: 2em;";> D) 在MVC架构中 jsp通常做控制层 </p><p style="text-indent: 2em;";>(B) 171、__充当应用程序视图对象和模型对象的中间对象。 </p><p style="text-indent: 2em;";> A) M </p><p style="text-indent: 2em;";> B) C </p><p style="text-indent: 2em;";> C) V </p><p style="text-indent: 2em;";> D) JSP </p><p style="text-indent: 2em;";>(C) 172、MVC中的“M、V、C”分别用__表示。 </p><p style="text-indent: 2em;";> A) jsp servlet javabean </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> B) HTml javabean jsp </p><p style="text-indent: 2em;";> C) javabean jsp servlet </p><p style="text-indent: 2em;";> D) servlet html jsp </p><p style="text-indent: 2em;";>(B) 173、关于MVC模式说法正确的是__。 </p><p style="text-indent: 2em;";> A) 用来将代码分开的方法 </p><p style="text-indent: 2em;";> B) 将显示、流程控制、业务逻辑分开,提高维护性和分离复杂度 </p><p style="text-indent: 2em;";> C) 视图 模型 控制器模型 </p><p style="text-indent: 2em;";> D) 只用java才有的模型 </p><p style="text-indent: 2em;";>(B) 174、在MVC模式中,核心内容为__。 </p><p style="text-indent: 2em;";> A) view </p><p style="text-indent: 2em;";> B) control </p><p style="text-indent: 2em;";> C) model </p><p style="text-indent: 2em;";> D) 不确认 </p><p style="text-indent: 2em;";>(B) 175、下面是FileOutputStream对象写入的代码片段: </p><p style="text-indent: 2em;";> String filesMess="abcdef"; </p><p style="text-indent: 2em;";> FileOutputStream outf=new </p><p style="text-indent: 2em;";>FileOutputStream(fileName); </p><p style="text-indent: 2em;";> BufferedOutputStream bufferout=new </p><p style="text-indent: 2em;";>BufferedOutputStream(outf); </p><p style="text-indent: 2em;";> byte b[]=es(); </p><p style="text-indent: 2em;";> (b); </p><p style="text-indent: 2em;";> (); </p><p style="text-indent: 2em;";> (); </p><p style="text-indent: 2em;";> (); </p><p style="text-indent: 2em;";> 代码执行后,文件中会写入__字符串的字节码。 </p><p style="text-indent: 2em;";> A) "filesMess" </p><p style="text-indent: 2em;";> B) "abcdef" </p><p style="text-indent: 2em;";> C) "b" </p><p style="text-indent: 2em;";> D)不确定 </p><p style="text-indent: 2em;";>(B) 176、下列代码中rs为查询得到的结果集,代码运行后表格的每一行有__单元格。 </p><p style="text-indent: 2em;";> while(()){ </p><p style="text-indent: 2em;";> ("<tr>"); </p><p style="text-indent: 2em;";> ("<td>"+ing(1)+"</td>"); </p><p style="text-indent: 2em;";> ("<td>"+ing(2)+"</td>"); </p><p style="text-indent: 2em;";> ("<td>"+ing(3)+"</td>"); </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>("<td>"+ing("publish")+"</td>"); </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>("<td>"+at("price")+"</td>"); </p><p style="text-indent: 2em;";> ("</tr>"); } </p><p style="text-indent: 2em;";> A) 4 </p><p style="text-indent: 2em;";> B) 5 </p><p style="text-indent: 2em;";> C) 6 </p><p style="text-indent: 2em;";> D) 不确定 </p><p style="text-indent: 2em;";>(C) 177、下面__不是ResultSet接口的方法。 </p><p style="text-indent: 2em;";> A) next() </p><p style="text-indent: 2em;";> B) getString(int i) </p><p style="text-indent: 2em;";> C) getString(string str) </p><p style="text-indent: 2em;";> D) close() </p><p style="text-indent: 2em;";>(D) 178、下述选项中不属于JDBC基本功能的是__。 </p><p style="text-indent: 2em;";> A) 与数据库建立连接 </p><p style="text-indent: 2em;";> B) 提交SQL语句 </p><p style="text-indent: 2em;";> C) 处理查询结果 </p><p style="text-indent: 2em;";> D) 数据库维护管理 </p><p style="text-indent: 2em;";>(D) 179、下面对jdbc api描述错误的是__。 </p><p style="text-indent: 2em;";> A) DriverManager接口的getConnection()方法可以建立和数据库的连接 </p><p style="text-indent: 2em;";> B) Connection接口的createStatement()方法可以创10 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>建一个Statement对象 </p><p style="text-indent: 2em;";> C) Statement接口的executeQuery()方法可以发送select语句给数据库 </p><p style="text-indent: 2em;";> D) ResultSet接口表示执行insert语句后得到的结果集 </p><p style="text-indent: 2em;";>(D) 180、使用JDBC访问数据时,下面__不是常用的接口。 </p><p style="text-indent: 2em;";> D) 8000 </p><p style="text-indent: 2em;";>(B) 188、在HttpSession中写入和读取数据的方法是__。 </p><p style="text-indent: 2em;";> A) setParameter()和getParameter() </p><p style="text-indent: 2em;";> B) setAttributer()和getAttribute() </p><p style="text-indent: 2em;";> C) addAttributer()和getAttribute() </p><p style="text-indent: 2em;";> D) set()个get() </p><p style="text-indent: 2em;";> A) SQLConnection </p><p style="text-indent: 2em;";> B) ResultSet </p><p style="text-indent: 2em;";> C) Statement </p><p style="text-indent: 2em;";> D) PreparedStatement </p><p style="text-indent: 2em;";>(A) 181、在JDBC连接数据库编程应用开发中,利用__可以实现连接数据库。 </p><p style="text-indent: 2em;";> A) Connection类 </p><p style="text-indent: 2em;";> B) PreparedStatement类 </p><p style="text-indent: 2em;";> C) CallableStatement类 </p><p style="text-indent: 2em;";> D) Statement类 </p><p style="text-indent: 2em;";>(B) 182、为了实现在Java的程序中调用带参数的SQL语句,应该采用__来完成。 </p><p style="text-indent: 2em;";> A) Connection类 </p><p style="text-indent: 2em;";> B) PreparedStatement类 </p><p style="text-indent: 2em;";> C) ResultSet类 </p><p style="text-indent: 2em;";> D) Statement类 </p><p style="text-indent: 2em;";>(C) 183、在JDBC连接数据库编程应用开发中,利用__可以实现包装数据库中的结果集。 </p><p style="text-indent: 2em;";> A) Connection类 </p><p style="text-indent: 2em;";> B) PreparedStatement类 </p><p style="text-indent: 2em;";> C) ResultSet类 </p><p style="text-indent: 2em;";> D) Statement类 </p><p style="text-indent: 2em;";>(C) 184、__是微软公司提供的连接SQL Server 2000的JDBC驱动程序。 </p><p style="text-indent: 2em;";> A) Driver </p><p style="text-indent: 2em;";> B) bcDriver </p><p style="text-indent: 2em;";> C) verDriver </p><p style="text-indent: 2em;";> D) </p><p style="text-indent: 2em;";>(C)185、针对下述JSP页面,在Servlet中需要得到用户选择的爱好的数量,最合适的代码时__。 </p><p style="text-indent: 2em;";> <input type="checkbox" name="channel" value="网络"/>网络; </p><p style="text-indent: 2em;";> <input type="checkbox" name="channel" value="朋友推荐"/>朋友推荐; </p><p style="text-indent: 2em;";> <input type="checkbox" name="channel" value="报纸"/>报纸; </p><p style="text-indent: 2em;";> <input type="checkbox" name="channel" value="其他"/>其他; </p><p style="text-indent: 2em;";> A) ameter("aihao").length </p><p style="text-indent: 2em;";> B) ameter("aihao").size </p><p style="text-indent: 2em;";> C) ameterValues("aihao").length </p><p style="text-indent: 2em;";> D) ameterValues("aihao").size </p><p style="text-indent: 2em;";>(A) 186、用户使用POST方式提交的数据中存在汉字(使用GBK字符集),在Servlet中需要使用下面__个语句处理。 </p><p style="text-indent: 2em;";> A) rcterEncoding("GBK"); </p><p style="text-indent: 2em;";> B) </p><p style="text-indent: 2em;";>tentType("text/html;charset=GBK"); </p><p style="text-indent: 2em;";> C) rcterEncoding("GBK"); </p><p style="text-indent: 2em;";> D) </p><p style="text-indent: 2em;";>tentType("text/html;charset=GBK"); </p><p style="text-indent: 2em;";>(B) 187、Tomcat的默认端口是__。 </p><p style="text-indent: 2em;";> A) 80 </p><p style="text-indent: 2em;";> B) 8080 </p><p style="text-indent: 2em;";> C) 8088 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>(D) 189、下列不属于JSP构成元素的是__。 </p><p style="text-indent: 2em;";> A) 脚本 </p><p style="text-indent: 2em;";> B) 声明 </p><p style="text-indent: 2em;";> C) 表达式 </p><p style="text-indent: 2em;";> D) JavaScript </p><p style="text-indent: 2em;";> (C) 190、下列注释方式可以在JSP中使用,并且客户端无法查看的是__。 </p><p style="text-indent: 2em;";> A) <!—注释--> </p><p style="text-indent: 2em;";> B) <%注释%> </p><p style="text-indent: 2em;";> C) <%--注释--%> </p><p style="text-indent: 2em;";> D) <%!注释%> </p><p style="text-indent: 2em;";>(C) 191、在JSP页面中有下述代码,第二次访问此页面的输出是______ </p><p style="text-indent: 2em;";> <%! int x=0; %> </p><p style="text-indent: 2em;";> <% Int y=0; %> </p><p style="text-indent: 2em;";> <%=x++>,<%=y++> </p><p style="text-indent: 2em;";> A) 0,0 </p><p style="text-indent: 2em;";> B) 0,1 </p><p style="text-indent: 2em;";> C) 1,0 </p><p style="text-indent: 2em;";> D) 1,1 </p><p style="text-indent: 2em;";>(A) 192、下列useBean标准动作使用正确的是_____ </p><p style="text-indent: 2em;";> A) <jsp:useBean id="a" class="" </p><p style="text-indent: 2em;";>scope="request"></jsp:useBean> </p><p style="text-indent: 2em;";> B) <jsp:useBean name="a" class="" </p><p style="text-indent: 2em;";>scope="request"></jsp:useBean> </p><p style="text-indent: 2em;";> C) <jsp:useBean id="a" </p><p style="text-indent: 2em;";>class="Date" ></jsp:useBean> </p><p style="text-indent: 2em;";> D) <jsp:useBean name="a" class="" </p><p style="text-indent: 2em;";>scope="request"></jsp:useBean> </p><p style="text-indent: 2em;";>(D) 193、两个JSP文件中的代码如下,执行后的输出为__。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> <% ribute("name","JSP"); </p><p style="text-indent: 2em;";> ribute("name","JSP"); </p><p style="text-indent: 2em;";> direct(""); %> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> <% (ribute("name")); </p><p style="text-indent: 2em;";> (ribute("name")); %> </p><p style="text-indent: 2em;";> A) JSP JSP </p><p style="text-indent: 2em;";> B) null JSP </p><p style="text-indent: 2em;";> C) null null </p><p style="text-indent: 2em;";> D) null JSP </p><p style="text-indent: 2em;";>(D) 194、假设在helloapp应用中有一个HelloServlet类,它位于inker包下,那么这个类的class文件应该放在__目录下。 </p><p style="text-indent: 2em;";> A) helloapp/ </p><p style="text-indent: 2em;";> B) helloapp/WEB-INF/ </p><p style="text-indent: 2em;";> C) helloapp/WEB-INF/classes/ </p><p style="text-indent: 2em;";> D) </p><p style="text-indent: 2em;";>helloapp/WEB-INF/classes/org/javathinker/ </p><p style="text-indent: 2em;";>(C) 195、设在表单中有一组复选钮标记,如下列代码: </p><p style="text-indent: 2em;";> <form action="">选择城市 </p><p style="text-indent: 2em;";> <input type="checkbox" name="city" value="长春">长春</p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>11 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> <input type="checkbox" name="city" value="北京">北京</p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> <input type="checkbox" name="city" value="大连">大连</p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> <input type="checkbox" name="city" value="上海">上海</p><p style="text-indent: 2em;";></form> </p><p style="text-indent: 2em;";> 如果在是取city的值,最适合的方法为__。 </p><p style="text-indent: 2em;";> A) String city=ameter("city"); </p><p style="text-indent: 2em;";> B) String []cities=ameter("city"); </p><p style="text-indent: 2em;";> C) String </p><p style="text-indent: 2em;";>(AC) 03、HTML标记中<form>标记的method属性取值为____。(多选) </p><p style="text-indent: 2em;";> A) get </p><p style="text-indent: 2em;";> B) doGet </p><p style="text-indent: 2em;";> C) post </p><p style="text-indent: 2em;";> D) doPost </p><p style="text-indent: 2em;";>(CD) 04、JavaScript中常用的鼠标事件有____。(多选) </p><p style="text-indent: 2em;";> A) onMourseIn </p><p style="text-indent: 2em;";> B) onMouseLeave </p><p style="text-indent: 2em;";> C) onMouseMove </p><p style="text-indent: 2em;";> D) onMouseOver </p><p style="text-indent: 2em;";>[]cities=ameterValues("city"); </p><p style="text-indent: 2em;";> D) String city=ribute("city"); </p><p style="text-indent: 2em;";>(A) 196、JSP程序在第一次载入时被JSP引擎翻译成__。 </p><p style="text-indent: 2em;";> A) servlet文件 </p><p style="text-indent: 2em;";> B) html文件 </p><p style="text-indent: 2em;";> C) class文件 </p><p style="text-indent: 2em;";> D) java文件 </p><p style="text-indent: 2em;";>(C) 197、JDBC提供了3种接口来实现SQL语句的发送执行,其中用于执行存储过程的的SQL语句的是__。 </p><p style="text-indent: 2em;";> A) Statement </p><p style="text-indent: 2em;";> B) PrepareStatement </p><p style="text-indent: 2em;";> C) CallbleStatement </p><p style="text-indent: 2em;";> D) Execute </p><p style="text-indent: 2em;";>(A) 198、JSP页面在执行时是以__方式进行的。 </p><p style="text-indent: 2em;";> A) 编译式 </p><p style="text-indent: 2em;";> B) 解释式 </p><p style="text-indent: 2em;";> C) 转换式 </p><p style="text-indent: 2em;";> D) 翻译式 </p><p style="text-indent: 2em;";>(A) 199、在面向程序开发人员的JDBC API中,负责处理驱动的调入并且对产生的新的数据库连接提供支持的接口是__。 </p><p style="text-indent: 2em;";> A) Manager </p><p style="text-indent: 2em;";> B) tion </p><p style="text-indent: 2em;";> C) ent </p><p style="text-indent: 2em;";> D) Set </p><p style="text-indent: 2em;";>(A) 200、JDBC提供了3种接口来实现SQL语句的发送执行,其中用于执行简单的不带参数的SQL语句的是__。 </p><p style="text-indent: 2em;";> A) Statement </p><p style="text-indent: 2em;";> B) PrepareStatement </p><p style="text-indent: 2em;";> C) CallbleStatement </p><p style="text-indent: 2em;";> D) Execute </p><p style="text-indent: 2em;";>(B) 201、JSP和客户端交互的过程中,Web应用程序将处理结果以__对象的方式返回给JSP引擎。 </p><p style="text-indent: 2em;";> A) Request </p><p style="text-indent: 2em;";> B) Response </p><p style="text-indent: 2em;";> C) Servlet </p><p style="text-indent: 2em;";> D) HTML </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>二、多选题 </p><p style="text-indent: 2em;";>(ABD) 01、下列选项中属于动态网站技术的是____。(多选) </p><p style="text-indent: 2em;";> A) PHP </p><p style="text-indent: 2em;";> B) ASP </p><p style="text-indent: 2em;";> C) JavaScript </p><p style="text-indent: 2em;";> D) JSP </p><p style="text-indent: 2em;";>(BC) 02、下列____注释在JSP页面中是正确。(多选) </p><p style="text-indent: 2em;";> A) <--注释--> </p><p style="text-indent: 2em;";> B) <!--注释--> </p><p style="text-indent: 2em;";> C) <%--注释--%> </p><p style="text-indent: 2em;";> D) <%!--注释--%> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>(AD) 05、<jsp:param>动作元素经常与____元素一起使用。(多选) </p><p style="text-indent: 2em;";> A) <jsp:include> </p><p style="text-indent: 2em;";> B) <jsp:useBean> </p><p style="text-indent: 2em;";> C) <jsp:setProperty> </p><p style="text-indent: 2em;";> D) <jsp:forward> </p><p style="text-indent: 2em;";>(AC) 06、编写Servlet代码时,至少需要导入Servlet API </p><p style="text-indent: 2em;";>的____包。(多选) </p><p style="text-indent: 2em;";> A) t </p><p style="text-indent: 2em;";> B) </p><p style="text-indent: 2em;";> C) </p><p style="text-indent: 2em;";> D) </p><p style="text-indent: 2em;";>(ACD) 07、在部署Java Web时,____文件夹或文件时必须的。(多选) </p><p style="text-indent: 2em;";> A) 文件 </p><p style="text-indent: 2em;";> B) 文件 </p><p style="text-indent: 2em;";> C) WEB-INF文件夹 </p><p style="text-indent: 2em;";> D) classes文件夹 </p><p style="text-indent: 2em;";>(AD) 08、下面____对象可以在同一应用程序的不同网页间共享数据。(多选) </p><p style="text-indent: 2em;";> A) application </p><p style="text-indent: 2em;";> B) response </p><p style="text-indent: 2em;";> C) request </p><p style="text-indent: 2em;";> D) session </p><p style="text-indent: 2em;";>(AB) 09、下面____是ResultSet接口的方法。(多选) </p><p style="text-indent: 2em;";> A) next() </p><p style="text-indent: 2em;";> B) close() </p><p style="text-indent: 2em;";> C) back() </p><p style="text-indent: 2em;";> D) forward() </p><p style="text-indent: 2em;";>(AC) 10、某JSP程序中声明使用javaBean的语句如下:(多选) </p><p style="text-indent: 2em;";> <jsp:useBean id=”user” class=”” scope=”page”/> </p><p style="text-indent: 2em;";> 要取出该javaBean的loginName属性值,以下语句正确的是____。 </p><p style="text-indent: 2em;";> A) <jsp:getProperty name="user" </p><p style="text-indent: 2em;";>property="loginName"/> </p><p style="text-indent: 2em;";> B) <jsp:getProperty id="user" </p><p style="text-indent: 2em;";>property="loginName"/> </p><p style="text-indent: 2em;";> C) <%=inName()%> </p><p style="text-indent: 2em;";> D) <%=perty("loginName")%> </p><p style="text-indent: 2em;";>(AD) 11、关于下列代码片断分析正确的是____。(多选) </p><p style="text-indent: 2em;";> <form name="form1" action="" </p><p style="text-indent: 2em;";>method="post"> </p><p style="text-indent: 2em;";>... </form> </p><p style="text-indent: 2em;";> A) 表单的名称是form1 </p><p style="text-indent: 2em;";> B) 表单的数据提交的位置是post </p><p style="text-indent: 2em;";> C) 表单提交的数据将会出现在地址栏中 </p><p style="text-indent: 2em;";> D) 此表单提交数据的大小不受限制 </p><p style="text-indent: 2em;";>12 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>(AB) 12、下列关于Servlet的说法正确的是____。(多选) D) 如果JSP页面有错误将不再执行翻译步骤。 </p><p style="text-indent: 2em;";> A) Servlet是一种动态网站技术 </p><p style="text-indent: 2em;";> B) Servlet运行在服务端 </p><p style="text-indent: 2em;";> C) Servlet针对每个请求使用一个进程来处理 </p><p style="text-indent: 2em;";> D) Servlet与普通的Java类一样,可以直接运行,不需要环境支持 </p><p style="text-indent: 2em;";>(ABD) 13、下列关于Servlet的编写方式正确的是____。(多选) </p><p style="text-indent: 2em;";> A) 必须是HttpServlet的子类 </p><p style="text-indent: 2em;";> B) 通常需要覆盖doGet() 和doPost()方法或其一 </p><p style="text-indent: 2em;";> C) 通常需要覆盖service()方法 </p><p style="text-indent: 2em;";> D) 通常要在文件中声明<servlet>和<servlet-mapping>两个元素 </p><p style="text-indent: 2em;";>(BC) 14、下列关于Servlet生命周期的说法正确的是___。(多选) </p><p style="text-indent: 2em;";> A) 构造方法只会调用一次,在容器启动时调用 </p><p style="text-indent: 2em;";> B) init()方法只会调用一次,在第一次请求此Servlet时调用 </p><p style="text-indent: 2em;";> C) service()方法在每次请求此Servlet时都会被调用 </p><p style="text-indent: 2em;";> D) destroy()方法在每次请求完毕时会被调用 </p><p style="text-indent: 2em;";>(ABD) 16、写入和读取Cookie的代码分别是_____。(多选) </p><p style="text-indent: 2em;";> A) kies()和kies(); </p><p style="text-indent: 2em;";> B) kie()和kie(); </p><p style="text-indent: 2em;";> C) kies()和kies(); </p><p style="text-indent: 2em;";> D) kie()和kies(); </p><p style="text-indent: 2em;";>(AB) 17、HttpServletRequest的____方法可以得到会话。(多选) </p><p style="text-indent: 2em;";> A) getSession() </p><p style="text-indent: 2em;";> B) getSession(Boolean) </p><p style="text-indent: 2em;";> C) getRequestSession(); </p><p style="text-indent: 2em;";> D) getHttpSession(); </p><p style="text-indent: 2em;";>(ABCD) 18、下列选项中可以关闭会话的是_____。(多选) </p><p style="text-indent: 2em;";> A) 调用HttpSession的close方法 </p><p style="text-indent: 2em;";> B) 调用HttpSession的invalidate()方法 </p><p style="text-indent: 2em;";> C) 等待HttpSession超时 </p><p style="text-indent: 2em;";> D) 调用HttpServletRequest的getSession(false)方法 </p><p style="text-indent: 2em;";>(ABD) 19、下列关于ServletContext的说法正确的是____。(多选) </p><p style="text-indent: 2em;";> A) 一个应用对应一个ServletContext </p><p style="text-indent: 2em;";> B) ServletContext的范围比Session的范围要大。 </p><p style="text-indent: 2em;";> C) 第一个会话在ServletContext中保存了数据,第二个会话读取不到这些数据 </p><p style="text-indent: 2em;";> D) ServletContext使用setAttributer()和getAttribute()方法操作数据。 </p><p style="text-indent: 2em;";>(BD) 20、关于HttpSession的getAttibute()和setAttribute()方法,正确的说法是_____。(多选) </p><p style="text-indent: 2em;";> A) getAttributer()方法返回类型是String </p><p style="text-indent: 2em;";> B) getAttributer()方法返回类型是Object </p><p style="text-indent: 2em;";> C) setAttributer()方法保存数据时如果名字重复会抛出异常 </p><p style="text-indent: 2em;";> D) setAttributer()方法保存数据时如果名字重复会覆盖以前的数据 </p><p style="text-indent: 2em;";>(BCD) 21、下列关于JSP执行过程的说法正确的是____。(多选) </p><p style="text-indent: 2em;";> A) JSP在容器启动时会被翻译成Servlet,并编译为字节码文件。 </p><p style="text-indent: 2em;";> B) JSP在第一次被请求时会被翻译成Servlet,并编译成字节码文件。 </p><p style="text-indent: 2em;";> C) 在第二次请求时,将不再执行翻译步骤 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>(ABCD) 22、下列JSP表达式的写法正确的是_____。(多选) </p><p style="text-indent: 2em;";> A) <%="abcdefg".length()%> </p><p style="text-indent: 2em;";> B) <%="abcedfg"+123%> </p><p style="text-indent: 2em;";> C) <%=new ()%> </p><p style="text-indent: 2em;";> D) <%=this%> </p><p style="text-indent: 2em;";>(BD) 23、下列page指令的使用正确的是_____。(多选) </p><p style="text-indent: 2em;";> A) <%@ page import=".* .* "%> </p><p style="text-indent: 2em;";> B) <%@ page import=".*, .* "%> </p><p style="text-indent: 2em;";> C) <%@ page import=".*;.* "%> </p><p style="text-indent: 2em;";> D) <%@page import=".*" %> </p><p style="text-indent: 2em;";> <%@page import=".*" %> </p><p style="text-indent: 2em;";>(AC) 24、下列setProperty标准动作使用正确的是_____。(多选) </p><p style="text-indent: 2em;";> A) <jsp:setProperty name="id" property="name" </p><p style="text-indent: 2em;";>value="name"/> </p><p style="text-indent: 2em;";> B) <jsp:setProperty id="id" property="name" </p><p style="text-indent: 2em;";>value="name"/> </p><p style="text-indent: 2em;";> C) <jsp:setProperty name="id" property="name" </p><p style="text-indent: 2em;";>value="name"/> </p><p style="text-indent: 2em;";> D) <jsp:setProperty id="id" property="name" </p><p style="text-indent: 2em;";>value="name"/> </p><p style="text-indent: 2em;";>(BC) 25、下列关于getProperty标准动作的说法正确的是_____。(多选) </p><p style="text-indent: 2em;";> A、当JavaBean不存在所访问的属性时,显示null </p><p style="text-indent: 2em;";> B、当JavaBean不存在所访问的属性时,发生异常 </p><p style="text-indent: 2em;";> C、getProperty标准动作实际上是调用对应属性的get方法 </p><p style="text-indent: 2em;";> D、以上都不对 </p><p style="text-indent: 2em;";>(ABC) 26、下列属于JSP内置对象的是____。(多选) </p><p style="text-indent: 2em;";> A) request </p><p style="text-indent: 2em;";> B) response </p><p style="text-indent: 2em;";> C) session </p><p style="text-indent: 2em;";> D) servletContext </p><p style="text-indent: 2em;";>(BCD) 27、下列request和response内置对象的使用正确的是____。(多选) </p><p style="text-indent: 2em;";> A) </p><p style="text-indent: 2em;";>uestDispatcher("").forward(); </p><p style="text-indent: 2em;";> B) direct(""); </p><p style="text-indent: 2em;";> C) ameterValues("name"); </p><p style="text-indent: 2em;";> D) </p><p style="text-indent: 2em;";>tentType("text/html;charset=gbk"); </p><p style="text-indent: 2em;";>(BD) 28、派生HttpSerlet的Servlet子类的doGet方法通常可以抛出__异常。 </p><p style="text-indent: 2em;";> A) InterruptException </p><p style="text-indent: 2em;";> B) IOException </p><p style="text-indent: 2em;";> C) NullPointException </p><p style="text-indent: 2em;";> D) SerletException </p><p style="text-indent: 2em;";>(BC) 29、为了在JSP网页中包含同一WEB应用中其它JSP页面,可使用__方法。 </p><p style="text-indent: 2em;";> A) @import指令 </p><p style="text-indent: 2em;";> B) @include指令 </p><p style="text-indent: 2em;";> C) <jsp:include>动作 </p><p style="text-indent: 2em;";> D) <jsp:import>动作 </p><p style="text-indent: 2em;";>(AC)30、以下关于MVC设计模式中各个组件的作用说法正确的是__。 </p><p style="text-indent: 2em;";> A) MVC设计模式是软件设计中的典型结构之一。MVC是Model/View/Control的缩写。在这种设计结构下,应用程序分为三个组成部分:Model模型、View视图和13 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>Controller控制器,每个部分负责不同的功能。 C) 调用HttpServletRequest的getParameter方法, B) Controller提供应用业务逻辑,是指对业务数据、提供大小写敏感的参数名作为参数,获得表单数据 </p><p style="text-indent: 2em;";>业务信息的处理模块,包括对业务数据的存取、加工、综合 D) 调用HttpServletResponse的sendForm方法传送表等; 单数据 </p><p style="text-indent: 2em;";> C) .View是指用户界面,也就是用户与应用程序交互(ABD) 35、以下__是JSP技术的特性。 </p><p style="text-indent: 2em;";>的接口。用户可以通过view输入信息,另一方面应用程序 A) 分离业务逻辑和表示 </p><p style="text-indent: 2em;";>通过view将数据结果以某种形式显示给用户。 B) 编写一次,随处运行 </p><p style="text-indent: 2em;";> D) Model则负责View和Controller之间的流程控制。 C) 客户端Java资源的高效利用 </p><p style="text-indent: 2em;";>(ABD) 31、以下__是常用的Web服务器。 D) 可重用的组件和标签库 </p><p style="text-indent: 2em;";> A) Apache Tomcat (ABC) 36、JSP页面包括以下__元素。 </p><p style="text-indent: 2em;";> B) Allaire JRun A) JSP指令 </p><p style="text-indent: 2em;";> C) JBuilder B) JSP Action </p><p style="text-indent: 2em;";> D) IIS C) JSP脚本 </p><p style="text-indent: 2em;";>(ABC) 32、一旦初始化了Servlet,Servlet就能随时等候 D) JSP控件 </p><p style="text-indent: 2em;";>处理请求。对于每一个请求,通常调用service方法。(ACD) 37、JSP生命周期可以分为以下__阶段。 </p><p style="text-indent: 2em;";>service方法会根据所接收到的HTTP请求的类型调用以下 A) 编译、装载 </p><p style="text-indent: 2em;";>__方法。 B) 创建、转换 </p><p style="text-indent: 2em;";> A) doGet() C) 初始化、执行 </p><p style="text-indent: 2em;";> B) doPost() D) 清理、卸载 </p><p style="text-indent: 2em;";> C) doPut() (ABD) 38、以下JSP指令说明正确的是__。 </p><p style="text-indent: 2em;";> D) doCreate() A) JSP指令是JSP页面被编译成servlet时由JSP引(ACD) 33、服务器在删除一个以前装载的servlet实例时会擎处理的指令。 </p><p style="text-indent: 2em;";>调用servlet 的 destroy方法。通常在这个方法中执行 B) page指令通过导入类、定制Servlet的超类、设置下列__操作。 内容类型等,可以控制Servlet的结构; </p><p style="text-indent: 2em;";> A) 释放数据库连接 C) include指令可以在JSP文件转换成Servlet时, B) 由可用服务状态转为服务不可用状态 将Servlet类链接到外部文件; </p><p style="text-indent: 2em;";> C) 停止后台线程 D) taglib指令用于定义定制的标记; </p><p style="text-indent: 2em;";> D) 关闭文件 (ABC) 39、使用JavaBean的好处有__。 </p><p style="text-indent: 2em;";>(AC) 34、动态建立Web页面的一个主要动力是使结果基于 A) JavaBean拥有标准化接口的优点,在开发期有可视用户提供的查询数据。Web表单处理即是从Web页面获取信化编程工具的支持,在运行期有JSP和J2EE连接器的支持。 </p><p style="text-indent: 2em;";>息,将其传送给服务器端应用程序。传送的方式包括以下__ B) JavaBean更明确的把WEB页面的设计和软件的设计两种。 区分开来。 </p><p style="text-indent: 2em;";> A) 表单数据放置在问号之后,附加在URL的后面,发 C) JavaBean可以在多个应用程序中重用。 </p><p style="text-indent: 2em;";>送到服务器上 D) JavaBean可以实现安全性、事务行为、并发性和持 B) 表单数据通过嵌入在HTML中的脚本加密传送到服久性。 </p><p style="text-indent: 2em;";>务器上 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>二、判断题 </p><p style="text-indent: 2em;";>(×)01、Internet和intranet的含义意义相同。 </p><p style="text-indent: 2em;";>(√)02、Web开发技术包括客户端和服务器端的技术。 </p><p style="text-indent: 2em;";>(√)03、在网页中图形文件与网页文件是分别存储的。 </p><p style="text-indent: 2em;";>(×)04、超级链接可以将文本作为链接对象,但不允许将图像作为链接对象。 </p><p style="text-indent: 2em;";>(×)05、表单域可以单独使用,不一定非要放在<form>元素中。 </p><p style="text-indent: 2em;";>(√)06、在网页中图形文件与网页文件是分别存储的。 </p><p style="text-indent: 2em;";>(√)07、绝度路径是文件名的完整路径;相对路径是指相对当前网页文件名的路径。 </p><p style="text-indent: 2em;";>(×)08、当样式定义重复出现的时候,最先定义的样式起作用。 </p><p style="text-indent: 2em;";>(×)09、一个表单只能有一个提交按钮。 </p><p style="text-indent: 2em;";>(×)10、JSP也可以使用C#等语言实现。 </p><p style="text-indent: 2em;";>(×)11、JSP页面是采用JavaScript语言实现在服务端代码。 </p><p style="text-indent: 2em;";>(√)12、在HTML页面文件中加入JSP脚本元素、JSP标记等就构成了一个JSP页面。 </p><p style="text-indent: 2em;";>(×)13、JSP页面中的指令标记、JSP动作标记统称为脚本元素。 </p><p style="text-indent: 2em;";>(×)14、在“<%!”和“%>”标记之间声明的Java的变量在整个页面内有效,不同的客户之间不可以共享。 </p><p style="text-indent: 2em;";>(√)15、程序片变量不同于在“<%!”和“%>”之间声明的页面成员变量,不能在不同客户访问页面的线程之间共享。 </p><p style="text-indent: 2em;";>(×)16、页面成员方法不可以在页面的Java程序片中调用。 </p><p style="text-indent: 2em;";>(√)17、程序片变量的有效范围与其声明位置有关,即从声明位置向后有效,可以在声明位置后的程序片、表达式中使用。 </p><p style="text-indent: 2em;";>(√)18、在“<%!”和“%>”标记之间声明的Java的方法在整个页面内有效。 </p><p style="text-indent: 2em;";>(√)19、JSP页面中的变量和方法声明(Declaration)、表达式(Expression)和Java程序片(Scriptlet)统称为JSP标记。 </p><p style="text-indent: 2em;";>(√)20、用户在浏览器中输入127.0.0.1:8080/ch2/ch2_即可访问本机上的该页面。 </p><p style="text-indent: 2em;";>(√)21、在“<%!”和“%>”标记之间声明的Java的方法在整个页面内有效。 </p><p style="text-indent: 2em;";> 14 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>(√)22、程序段变量的有效范围与其声明位置有关,即从声明位置向后有效,可以在声明位置后的程序片、表达式中使用。 </p><p style="text-indent: 2em;";>(√)23、Post属于表单的隐式提交信息方法。 </p><p style="text-indent: 2em;";>(√)24、jsp:include动作标记与include指令标记包含文件的处理时间和方式不同。 </p><p style="text-indent: 2em;";>(×)25、<jsp:forward ... >标记的page属性值是相对的URL地址,只能静态的URL。 </p><p style="text-indent: 2em;";>(×)26、JSP页面只能在客户端执行。 </p><p style="text-indent: 2em;";>(×)27、JSP页面中不能包含脚本元素。 </p><p style="text-indent: 2em;";>(×)28、Page指令不能定义当前JSP程序的全局属性。 </p><p style="text-indent: 2em;";>(√)29、out对象是一个输出流,它实现了ter接口,用来向客户端输出数据。 </p><p style="text-indent: 2em;";>(×)30、利用response对象的sendRedirect方法只能实现本网站内的页面跳转,但不能传递参数。 </p><p style="text-indent: 2em;";>(√)31、respone对象主要用于向客户端发送数据。 </p><p style="text-indent: 2em;";>(×)32、不可以用一个page指令指定多个属性的取值。 </p><p style="text-indent: 2em;";>(√)33、JSP中Java表达式的值由服务器负责计算,并将计算值按字符串发送给客户端显示。 </p><p style="text-indent: 2em;";>(×)34、在Java程序片中可以使用Java语言的注释方法,其注释的内容会发送到客户端。 </p><p style="text-indent: 2em;";>(√)35、jsp:param动作标记不能单独使用,必须作为jsp:include、jsp:forward标记等的子标记使用,并为它们提供参数。 </p><p style="text-indent: 2em;";>(×)36、Tomcat服务器支持直接使用application对象。 </p><p style="text-indent: 2em;";>(×)37、利用response对象的sendRedirect方法只能实现本网站内的页面跳转,但不能传递参数。 </p><p style="text-indent: 2em;";>(√)38、response对象的sendRedirect(URL url)方法可以将当前客户端的请求转到其他页面去。 </p><p style="text-indent: 2em;";>(×)39、contentType属性用来设置JSP页面的MIME类型和字符编码集,取值格式为"MIME类型"或"MIME类型;charset=字符编码集",response对象调用addHeader方法修改该属性的值。 </p><p style="text-indent: 2em;";>(×)40、JavaBean的属性必须声明为public,方法必须声明为private访问类型。 </p><p style="text-indent: 2em;";>(√)41、doGet()和doPost()方法分别处理客户端GET和POST方法发送的请求。 </p><p style="text-indent: 2em;";>(√)42、RandomAccessFile类既不是输入流类InputSteam的子类,也不是输出流类OutputStream的子类,但它同时实现了DataInput和DataOutput接口。 </p><p style="text-indent: 2em;";>(×)43、在MVC模式的Web开发中,“视图”、“模型”和“控制器”分别对应着“JSP页面”、“JavaScript”和“Serlvet”,以Servlet为核心。 </p><p style="text-indent: 2em;";>(×)44、表单信息的验证只能放在服务器端执行。 </p><p style="text-indent: 2em;";>(×)45、网页中只要使用gb2312编码就不会出现中文乱码。 </p><p style="text-indent: 2em;";>(√)46、表单提交的信息就封装在HTTP请求消息的信息体部分,用户使用request对象的getParameter方法可以得到通过表单提交的信息。 </p><p style="text-indent: 2em;";>(√)47、同一个客户在同一个Web服务目录中的session对象是相同的,在不同的Web服务目录中的session对象是不相同的。 </p><p style="text-indent: 2em;";>(×)48、session对象是HttpSession接口类的实例,由服务器端负责创建和销毁,所以不同客户的session对象不同。 </p><p style="text-indent: 2em;";>(×)49、public long InactiveInterval() 设置最长发呆时间,单位毫秒。 </p><p style="text-indent: 2em;";>(√)50、session对象可以用来保存用户会话期间需要保存的数据信息。 </p><p style="text-indent: 2em;";>(×)51、url重写可以把session对象的id作为url参数传带过去,可以使用request对象的encodeURL("")。 </p><p style="text-indent: 2em;";>(√)52、application对象对所有用户都是共享的,任何对它的操作都会影响到所有的用户。 </p><p style="text-indent: 2em;";>(×)53、JSP代码可以直接执行,所以不会被翻译成JAVA代码。 </p><p style="text-indent: 2em;";>(×)54、JSP里声明一个方法(函数)是用<% %>标签。 </p><p style="text-indent: 2em;";>(√)55、如果两个不同的JSP页面有相同的SessionID,则这两个页面一定是同一个会话。 </p><p style="text-indent: 2em;";>(×)56、JDBC是用来连接数据的。 </p><p style="text-indent: 2em;";>(×)57、Servlet是单线程的。 </p><p style="text-indent: 2em;";>(√)58、executeUpdate()是Statement接口的方法。 </p><p style="text-indent: 2em;";>(×)59、Servlet可以运行在客户端。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>三、填空题 </p><p style="text-indent: 2em;";>01、动态网站技术采用【B/S】架构。 </p><p style="text-indent: 2em;";>02、在HTML中用【 】标记表示一个空格符号。 </p><p style="text-indent: 2em;";>03、在javaScrpt中window对象的【open()】方法用于打开一个新窗口。 </p><p style="text-indent: 2em;";>04、在javaScrpt中window对象的【close()】方法用于关闭当前窗口。 </p><p style="text-indent: 2em;";>05、使用JavaScript语言中Document的【()】方法可以在页面上输出字符。 </p><p style="text-indent: 2em;";>06、Tomcat服务器的默认端口是【8080】。修改Tomcat的端口可以在Tomcat下打开conf文件夹找到【】文件用记事本打开设置<Connector port="8080">即可。 </p><p style="text-indent: 2em;";>07、异常的处理,可在该方法的代码段中包含3类代码:【try】、【catch】和finally代码块。 </p><p style="text-indent: 2em;";>08、Jsp主要内置对象有:【Application】、Session、【Request】、Response、Out、【Exception】、 PageContext、Config、Page。 </p><p style="text-indent: 2em;";>09、如编写一个计数器程序,用来记载当前网站访问量,最好采用JSP中【application】对象。 </p><p style="text-indent: 2em;";>10、理论上,【GET】是用于获取服务器信息并将其作为响应返回给客户端,【POST】是用于客户端把数据传送到服务器 。 </p><p style="text-indent: 2em;";>11、【Application】对象是代表应用程序上下文,它允许JSP页面与包括在同一应用程序中的任何Web组件共享信息,而Session对象则是每个客户专用的。 </p><p style="text-indent: 2em;";> 15 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>12、JSP页面中的6个基本元素包括声明、表达式、脚本、【指令】、【动作标记】和注释。 </p><p style="text-indent: 2em;";>13、JDBC的主要任务是:【与数据库建立连接】、【发送SQL语句】、处理结果。 </p><p style="text-indent: 2em;";>14、一个Bean由三部分组成:实现【izable】接口、提供无参数的构造方法、提供【getter()】和【setter()】方法访问它的属性。 </p><p style="text-indent: 2em;";>15、运行servlet需要在【】文件中注册。 </p><p style="text-indent: 2em;";>16、Servlet的生命周期分三个时期:【装载Servlet】、创建一个Servlet实例、【销毁】。 </p><p style="text-indent: 2em;";>17、Jsp开发网站的两种模式分为【Jsp+JavaBean】和【Jsp+JavaBean+Servlet】。 </p><p style="text-indent: 2em;";>18、在tomcat上发布javaweb应用时的默认目录是【webapps】目录。 </p><p style="text-indent: 2em;";>19、javaweb应用的部署描述符是指【】文件。 </p><p style="text-indent: 2em;";>20、在tomcat中访问helloapp应用的文件时,在浏览器地址栏应写的url为: </p><p style="text-indent: 2em;";>【localhost:8080/helloapp/】。 </p><p style="text-indent: 2em;";>21、Servlet容器启动每一个web应用时,都会为它创建一个唯一的【ServletContext】对象,该对象和web应用有相同的生命周期。 </p><p style="text-indent: 2em;";>22、请求转发源组件的响应结果【不会】发送到客户端,包含【会】发送到客户端。(填“会”或“不会”) </p><p style="text-indent: 2em;";>23、jsp中实现请求转发的标记为:【jsp:forward>】。 </p><p style="text-indent: 2em;";>24、在JSP中,request内置对象代表请求消息,response内置对象代表响应消息,【session】内置对象代表会话。 </p><p style="text-indent: 2em;";>25、如果使用第四类jdbc驱动器连接数据库,jar文件的存放位置为“web应用/【WEB-INF】/lib”。 </p><p style="text-indent: 2em;";>26、Servlet容器为每个HttpSession对象分配唯一标识符,叫做【SessionID】。 </p><p style="text-indent: 2em;";>27、javaweb在mvc设计模式下,【javabean】是模型,【jsp】是视图,【servlet】是控制器。 </p><p style="text-indent: 2em;";>28、指令标识通常以【<%@】标记开始,以【%>】标记结束。 </p><p style="text-indent: 2em;";>29、如果想在JSP页面中调用exception对象输出错误信息,需要将页面指令的【isErropage】属性设置为true。 </p><p style="text-indent: 2em;";>30、页面指令的【import】属性可出现多次。 </p><p style="text-indent: 2em;";>31、表达式用于向页面输出信息,其使用格式是以【<%=】标记开始,以【%>】标记结束。 </p><p style="text-indent: 2em;";>32、在页面中通过声明标识声明的变量和方法的有效范围为【整个页面】,他们将成为JSP页面被转换成Java类后类中的【属性】和【方法】。 </p><p style="text-indent: 2em;";>33、通常应用【<jsp:useBean>】动作标识可以在JSP页面中创建一个Bean实例,并且通过属性的设置可以将该实例存储到JSP中的指定范围内。 </p><p style="text-indent: 2em;";>34、在JSP中通过虚拟目录获取真实的物理目录的方法为【lPath()】。 </p><p style="text-indent: 2em;";>35、在JSP内置对象中,【request】对象是从客户端向服务器端发出请求,包括用户提交的信息以及客户端的一些信息,此对象的【getparameter】方法可以获取客户端表单中某输入框提交的信息。 </p><p style="text-indent: 2em;";>36、在JSP内置对象中,【response】对象提供了设置HTTP响应报头的方法。 </p><p style="text-indent: 2em;";>37、JSP内置对象的有效范围由小到大为【page】、【request】、【session】和【application】。 </p><p style="text-indent: 2em;";>38、按功能JavaBean可以分为【可视化JavaBean】和【非可视化JavaBean】。 </p><p style="text-indent: 2em;";>39、通常情况下通过类的【forName(String className)】方法加载要连接数据库的Driver类。 </p><p style="text-indent: 2em;";>40、当今比较流行的技术研发模式是【C/S】和【B/S】的体系结构来实现的。 </p><p style="text-indent: 2em;";>41、如果要获取请求客户端的IP地址,应使用【request】对象。 </p><p style="text-indent: 2em;";>42、URL是Uniform Resource Locator的缩写,中文称之为【统一资源定位器】。 </p><p style="text-indent: 2em;";>43、JSP页面的基本构成元素,其中变量和方法声明(Declaration)、表达式(Expression)和Java程序片(Scriptlet)统称为【JSP脚本元素】。 </p><p style="text-indent: 2em;";>44、“<%!”和“%>”之间声明的方法在整个页面内有效,称为【页面的成员方法】。 </p><p style="text-indent: 2em;";>45、JSP页面中,输出型注释的内容写在【<!--】和【-->】之间。 </p><p style="text-indent: 2em;";>46、Page指令的属性Language的默认值是【Java】。 </p><p style="text-indent: 2em;";>47、表单的提交方法包括【post】和【get】方法。 </p><p style="text-indent: 2em;";>48、out对象的【()】方法,功能是输出缓冲的内容。 </p><p style="text-indent: 2em;";>49、使用Bean首先要在JSP页面中使用【import】指令将Bean引入。 </p><p style="text-indent: 2em;";>50、创建JavaBean的过程和编写Java类的过程基本相似,可以在任何Java的编程环境下完成【编写、编译和发布】。 </p><p style="text-indent: 2em;";>51、response对象的【setContentType()】用来定义服务器发送给客户端的MIME类型。 </p><p style="text-indent: 2em;";>52、Servlet中使用Session对象的步骤为:调用【sion()】得到Session对象,查看Session对象,在会话中保存数据。 </p><p style="text-indent: 2em;";>53、在Tomcat服务器中部署Web应用程序时,静态页面和一般资源存放到tomcat服务的【webapps】目录中。 </p><p style="text-indent: 2em;";>54、在Servlet中用来接收客户表单数据的两个常用方法为【get】、【post】。 </p><p style="text-indent: 2em;";>55、控制器主要负责两方面的动作:【把用户的请求分发到相应的模型】;【将模型的改变及时反映到视图上】。 </p><p style="text-indent: 2em;";>56、在DOM接口规范中,有四个基本接口:【Node】、【Nodelist】、【NamedNodeMap】和【Document】。 </p><p style="text-indent: 2em;";>57、在一个应用程序中不同的页面共享数据时,最好的JSP内置对象为【application】。 </p><p style="text-indent: 2em;";>58、动态include标记里面可以加【<jsp:param>】动作标记,用来传递参数。 </p><p style="text-indent: 2em;";>59、session对象能否和客户建立起一一对应关系依赖与客户的浏览器是否支持【cookie】。 </p><p style="text-indent: 2em;";>60、JDBC中【connection】接口用于连接数据库。 </p><p style="text-indent: 2em;";>61、ResulSet接口的【next()】方法可以使结果集指针指向下行数据。 </p><p style="text-indent: 2em;";>62、javabean与一般的java类的最大区别是javabean里面必须有【setter】和【getter】方法,并且与属性相对应。 </p><p style="text-indent: 2em;";>63、查询数据库里的表内容是Statement接口使用【executeUpdate()】方法。 </p><p style="text-indent: 2em;";> 16 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>64、JSP连接数据库的时候第一步是【加载驱动程序】。 </p><p style="text-indent: 2em;";>65、使用useBean动作标记的时候scope属性有4种选项,作用范围由小到大是【page】、【request】、【session】、【application】,其中【session】是指当关闭浏览器的时候这个javabean失效,【application】是指当关闭服务器的时候这个javabean失效。 </p><p style="text-indent: 2em;";>66、在Servlet中转发使用RequestDespacher接口的【forward()】方法实现。重定向由HttpServletResponse接口的【sendRedirect()】方法实现。 </p><p style="text-indent: 2em;";>67、使得HttpSession失效的三种方式是:【关闭浏览器】、调用session的invalidate方法和【等待session超时】。 </p><p style="text-indent: 2em;";>68、JavaBean是一种JAVA语言写成的可重用组件。JavaBean的类必须是具体的和【公有的】,并且具有【无参数】的构造方法。 </p><p style="text-indent: 2em;";>69、JDBC的接口分为两个层次:一个是程序开发人员的JDBC【API】,另一个是底层的JDBC【Driver API】。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>四、简答题 </p><p style="text-indent: 2em;";>01、jsp有哪些内置对象?作用分别是什么? </p><p style="text-indent: 2em;";>答:(1) Out对象代表提供输出流的访问。 </p><p style="text-indent: 2em;";> (2) Request对象提供对Http请求数据的访问,同时还提供用于加入特定请求数据的上下文。 </p><p style="text-indent: 2em;";> (3) Response对象允许直接访问HttpServletResponse对象。 </p><p style="text-indent: 2em;";> (4) Session对象可能是状态管理上下文中使用最多的对话。 </p><p style="text-indent: 2em;";> (5) application对象代表应用程序上下文,它允许JSP页面与包括在同一应用程序中的任何Web组件共享信息。 </p><p style="text-indent: 2em;";> (6) Config对象允许将初始化数据传递给一个JSP页面。 </p><p style="text-indent: 2em;";> (7) Exception对象含有只能由指定的JSP“错误处理页面”访问的异常数据。 </p><p style="text-indent: 2em;";> (8) Page对象代表JSP页面对应的Servlet类实例。 </p><p style="text-indent: 2em;";> (9) PageContext对象是Jsp页面本身的上下文,它提供唯一一组方法来管理具有不同作用域的属性。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>02、jsp有哪些动作?作用分别是什么? </p><p style="text-indent: 2em;";>答:JSP共有以下6种基本动作 </p><p style="text-indent: 2em;";> (1) jsp:include:在页面被请求的时候引入一个文件。 </p><p style="text-indent: 2em;";> (2) jsp:useBean:寻找或者实例化一个JavaBean。 </p><p style="text-indent: 2em;";> (3) jsp:setProperty:设置JavaBean的属性。 </p><p style="text-indent: 2em;";> (4) jsp:getProperty:输出某个JavaBean的属性。 </p><p style="text-indent: 2em;";> (5) jsp:forward:把请求转到一个新的页面。 </p><p style="text-indent: 2em;";> (6) jsp:plugin:根据浏览器类型为Java插件生成OBJECT或EMBED标记 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>03、简述JSP的处理过程。 </p><p style="text-indent: 2em;";>答:(1) 客户端通过浏览器向服务器发出请求,该请求中包含了请求的资源的路径 </p><p style="text-indent: 2em;";> (2) 服务器根据被加载的客户端的请求加载被请求的JSP页面 </p><p style="text-indent: 2em;";> (3) Web服务器中的JSP引擎把被加载的JSP页面转换成servlet </p><p style="text-indent: 2em;";> (4) JSP引擎把生成的JSP页面编译成class文件 </p><p style="text-indent: 2em;";> (5) 服务器执行这个class文件 </p><p style="text-indent: 2em;";> (6) 服务器把执行结果发送给浏览器显示 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>04、在JSP中有哪几种注释的方法? </p><p style="text-indent: 2em;";>答:主要有以下四种注释方法: </p><p style="text-indent: 2em;";> (1) <%-- 注释 --%> </p><p style="text-indent: 2em;";> (2) // 注释 </p><p style="text-indent: 2em;";> (3) /** 注释 **/ </p><p style="text-indent: 2em;";> (4) <!—注释 --> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>05、简述JSP页面中的组成元素。 </p><p style="text-indent: 2em;";>JSP页面主要有6类基本元素组成: </p><p style="text-indent: 2em;";>(1) JSP指令:用来向JSP容器提供编译信息。 </p><p style="text-indent: 2em;";>(2) JSP声明:用于在JSP页面中定义变量和方法。 </p><p style="text-indent: 2em;";>(3) JSP表达式:用于将Java表达式的运行结果输出在页面中。 </p><p style="text-indent: 2em;";>(4) JSP脚本:用于在JSP页面中插入Java代码。 </p><p style="text-indent: 2em;";>(5) JSP动作:实现一些常见的特定功能。 </p><p style="text-indent: 2em;";>(6) JSP注释 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>06、Servlet的基本架构 </p><p style="text-indent: 2em;";>答:public class ServletName extends HttpServlet { </p><p style="text-indent: 2em;";> public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, </p><p style="text-indent: 2em;";>IOException { } </p><p style="text-indent: 2em;";> 17 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, </p><p style="text-indent: 2em;";>IOException { } </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>07、Servlet执行时一般实现哪几个方法? </p><p style="text-indent: 2em;";>答:(1) public void init(ServletConfig config) </p><p style="text-indent: 2em;";> (2) public ServletConfig getServletConfig() </p><p style="text-indent: 2em;";> (3) public String getServletInfo() </p><p style="text-indent: 2em;";> (4) public void service(ServletRequest request,ServletResponse response) </p><p style="text-indent: 2em;";> (5) public void destroy() </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>08、表单提交方式中的get和post有什么区别? </p><p style="text-indent: 2em;";>答:Form 中的 get 和 post 方法,在数据传输过程中分别对应了 HTTP 协议中的GET 和 POST 方法。二者主要区别如下: </p><p style="text-indent: 2em;";>1)Get 是用来从服务器上获得数据,而 Post 是用来向服务器上传递数据; </p><p style="text-indent: 2em;";>2)Get 将表单中数据按照 variable=value 的形式,添加到 action 所指向的URL 后面,并且两者使用“?”连接,而各个变量之间使用“&”连接;Post 是将表单中的数据放在 form 的数据体中,按照变量和值相对应的方式,传递到 action所指向 URL; </p><p style="text-indent: 2em;";>3)Get 是不安全的,因为在传输过程,数据被放在请求的 URL 中;Post 的所有操作对用户来说都是不可见的; </p><p style="text-indent: 2em;";>4)Get 传输的数据量小,这主要是因为受 URL 长度限制;而 Post 可以传输大量的数据,所以在上传文件只能使用 Post; </p><p style="text-indent: 2em;";>5)Get 限制 Form 表单的数据集必须为 ASCII 字符,而 Post 支持整个 ISO10646字符集; </p><p style="text-indent: 2em;";>6)Get 是 Form 的默认方法。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>09、Java Servlet的主要功能和作用是什么? </p><p style="text-indent: 2em;";>答:Servlet 通过创建一个框架来扩展服务器的能力,以提供在 Web 上进行请求和响应服务。当客户机发送请求至服务器时,服务器可以将请求信息发送给 Servlet ,并让 Servlet 建立起服务器返回给客户机的响应。 当启动 Web 服务器或客户机第一次请求服务时,可以自动装入 Servlet 。装入后, Servlet 继续运行直到其它客户机发出请求。 Servlet 的功能涉及范围很广。例如, Servlet 可完成如下功能: </p><p style="text-indent: 2em;";> (1) 创建并返回一个包含基于客户请求性质的动态内容的完整的 HTML 页面。 </p><p style="text-indent: 2em;";> (2) 创建可嵌入到现有 HTML 页面中的一部分 HTML 页面( HTML 片段)。 </p><p style="text-indent: 2em;";> (3) 与其它服务器资源(包括数据库和基于 Java 的应用程序)进行通信。 </p><p style="text-indent: 2em;";> (4) 用多个客户机处理连接,接收多个客户机的输入,并将结果广播到多个客户机上。例如, Servlet 可以是多参与者的游戏服务器。 </p><p style="text-indent: 2em;";> (5) 当允许在单连接方式下传送数据的情况下,在浏览器上打开服务器至 applet 的新连接,并将该连接保持在打开状态。当允许客户机和服务器简单、高效地执行会话的情况下, applet 也可以启动客户浏览器和服务器之间的连接。可以通过定制协议或标准(如 IIOP)进行通信。 </p><p style="text-indent: 2em;";> (6) 对特殊的处理采用 MIME 类型过滤数据,例如图像转换和服务器端包括(SSI)。 </p><p style="text-indent: 2em;";> (7) 将定制的处理提供给所有服务器的标准例行程序。例如, Servlet 可以修改如何认证用户。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>10、JSP和Servlet有哪些相同点和不同点,他们之间的联系是什么? </p><p style="text-indent: 2em;";>答:JSP技术是建立在Servlet技术基础之上的,本质上是Servlet的简易方式,更强调应用的外表表达。 </p><p style="text-indent: 2em;";> JSP编译后是“类servlet”,所有的JSP页面最终都要被转换成Servlet来运行。 </p><p style="text-indent: 2em;";> 目前,一个web应用往往由多个servlet和jsp组成。 </p><p style="text-indent: 2em;";> Servlet和JSP最主要的不同点在于,Servlet的应用逻辑是在Java文件中,并且完全从表示层中的HTML里分离开来。 </p><p style="text-indent: 2em;";> 而JSP的情况是Java和HTML可以组合成一个扩展名为.jsp的文件。 </p><p style="text-indent: 2em;";> JSP侧重于视图,负责显示工作完成;Servlet主要用于控制逻辑,负责流程控制功能。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>11、HttpServletResponse类的sendRedirect方法和RequestDispatcher类的forward方法有何不同? </p><p style="text-indent: 2em;";>答:HttpServletResponse类的sendRedirect方法可以把用户重新定向到其他页面或servlet,但是不能将用户对当前JSP页面或servlet的请求和响应 (HttpServletRequest对象和HttpServletResponse对象)传递给所重新定向JSP页面或servlet。 </p><p style="text-indent: 2em;";>RequestDispatcher对象使用forward方法可以把用户对当前JSP页面或servle的 请求转发给另一个JSP页面或servlet,而且将用户对当前JSP页面或servlet的请 求和响应(HttpServletRequest对象和HttpServletResponse对象)传递给所转发的JSP页面或servlet。也就是说,当前页面所要转发的目标页面或servlet对象可以使用request获取用户提交的数据。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>12、简述四种会作用域page/request/session/application。 </p><p style="text-indent: 2em;";>答:(1) page范围:具有page范围的对象被绑定到ntext对象中。在这个范围内的对象,只能在创建对象的页面中访问。可以调用pageContext这个隐含对象的getAttribute()方法来访问具有这种范围类型的对象(pageContext对象还提供了访问其他范围对象的getAttribute方法),pageContext对象本身也属于page范围。当Servlet类的_jspService()方法执行完毕,属于page范围的对象的引用将被丢弃。page范围内的对象,在客户端每次请求JSP页 18 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>面时创建,在页面向客户端发送回响应或请求被转发(forward)到其他的资源后被删除。 </p><p style="text-indent: 2em;";> (2) request范围:具有request范围的对象被绑定到tRequest对象中,可以调用request这个隐含对象的getAttribute()方法来访问具有这种范围类型的对象。在调用forward()方法转向的页面或者调用include()方法包含的页面中,都可以访问这个范围内的对象。要注意的是,因为请求对象对于每一个客户请求都是不同的,所以对于每一个新的请求,都要重新创建和删除这个范围内的对象 </p><p style="text-indent: 2em;";> (3) session范围:具有session范围的对象被绑定到ssion对象中,可以调用session这个隐含对象的getAttribute()方法来访问具有这种范围类型的对象。JSP容器为每一次会话,创建一个HttpSession对象,在会话期间,可以访问session范围内的对象。 </p><p style="text-indent: 2em;";> (4) application范围:具有application范围的对象被绑定到tContext中,可以调用application这个隐含对象的getAttribute()方法来访问具有这种范围类型的对象。在Web应用程序运行期间,所有的页面都可以访问在这个范围内的对象 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>13、简述Servlet的生命周期。 </p><p style="text-indent: 2em;";>答:servlet有良好的生存期的定义,包括加载和实例化、初始化、处理请求以及服务结束。这个生存期由t接口的init,service和destroy方法表达。 Servlet被服务器实例化后,容器运行其init方法,请求到达时运行其service方法,service方法自动派遣运行与请求对应的doXXX方法(doGet,doPost)等,当服务器决定将实例销毁的时候调用其destroy方法。 </p><p style="text-indent: 2em;";> 与cgi的区别在于servlet处于服务器进程中,它通过多线程方式运行其service方法,一个实例可以服务于多个请求,并且其实例一般不会销毁,而CGI对每个请求都产生新的进程,服务完成后就销毁,所以效率上低于servlet。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>14、JSP中动态INCLUDE与静态INCLUDE的区别? </p><p style="text-indent: 2em;";>答:(1) 动态INCLUDE用jsp:include动作实现 </p><p style="text-indent: 2em;";> <jsp:include page="" flush="true" />它总是会检查所含文件中的变化,适合用于包含动态页面,并且可以带参数 </p><p style="text-indent: 2em;";> (2) 静态INCLUDE用include伪码实现,定不会检查所含文件的变化,适用于包含静态页面 </p><p style="text-indent: 2em;";> <%@ include file="" %> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>15、两种跳转方式分别是什么?有什么区别? </p><p style="text-indent: 2em;";>答:有两种,分别为: </p><p style="text-indent: 2em;";> (1) <jsp:include page="" flush="true"> </p><p style="text-indent: 2em;";> (2) <jsp:forward page= ""/> </p><p style="text-indent: 2em;";> 前者页面不会转向include所指的页面,只是显示该页的结果,主页面还是原来的页面。执行完后还会回来,相当于函数调用。并且可以带参数.后者完全转向新页面,不会再回来。相当于go to 语句。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>16、简述请求转发和请求重定向的区别。 </p><p style="text-indent: 2em;";>答:进行请求转发时,存储在request对象中的信息会被保留并带到目标页面中;请求重定向是重新生成一个request请求,然后将该请求重定向到指定的URL,所以事先存储在request对象中的信息都不存在了。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>17、JSP 和 Servlet 中的请求转发分别如何实现? </p><p style="text-indent: 2em;";>答:JSP 中的请求转发可利用 forward 动作实现:<jsp:forward />;Serlvet 中实现请求转发的方式为:getServletContext().getRequestDispatcher(path).forward(req,res)。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>18、JSP中Model2的工作原理是什么? </p><p style="text-indent: 2em;";>JSP的Model2实际上就是引入了MVC设计模式,采用Servlet+JavaBean+JSP进行开发。 </p><p style="text-indent: 2em;";>Model2采用Servlet作为控制器(Controller)负责接收客户端Web浏览器发送来的所有请求,并依据处理的不同结果,转发到对应的JSP页面(Viewer)实现在浏览器客户端的显示。 </p><p style="text-indent: 2em;";>通常在Servlet中只包含了控制逻辑和一些简单的处理逻辑,更加复杂的业务处理逻辑则借助特定的JavaBean(Model)具体实现。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>19、简述include指令标识和<jsp:include>动作标识的差异。 </p><p style="text-indent: 2em;";>答:(1) inlcude指令通过file属性来确定被包含的页面,将file属性值看做一个实际存在的文件路径,所以该指令不支持任何表达式;<jsp:include>动作标识通过page属性确定被包含的页面,支持JSP表达式。 </p><p style="text-indent: 2em;";> (2) include指令包含的文件,内容会原封不动的插入到该指令的位置,与该指令合成进行编译,若改变了被包含文件,主文件要重新编译;<jsp:include>动作标识包含文件时,当该标识被执行时,程序会将请求转发到被包含的文件,并将执行结果输出到浏览器中,然后返回到包含文件继续执行后面的代码,JSP编译器对两个文件分别进行编译,被包含文件改动不会影响源文件。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>20、简述内置对象session和application的区别。 </p><p style="text-indent: 2em;";>答:Session对象和用户会话相关,不同用户的session是完全不同的对象,而用户的application对象都是相同的一个对象,即共享这个对象。 </p><p style="text-indent: 2em;";> 19 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>21、在Servlet的doGet()和doPost()方法中,如何得到与JSP内置对象out、request、rsponse、session、application分别对应的对象? </p><p style="text-indent: 2em;";>答:(1)可以通过以下代码获取out对象:PrintWriter out = ter(); </p><p style="text-indent: 2em;";> (2)Servlet直接继承了HttpServlet类,可以直接使用request和response对象 </p><p style="text-indent: 2em;";> (3)可以通过以下代码获取session对象:HttpSession session=sion(); </p><p style="text-indent: 2em;";> (4) application是tContext类的对象 </p><p style="text-indent: 2em;";> Application对象需要通过vletContext()来获取。 </p><p style="text-indent: 2em;";> Servlet自动定义了ServletConfig对象。故可以使用以下代码获取application对象 </p><p style="text-indent: 2em;";> ServletContext application =vletContext(); </p><p style="text-indent: 2em;";> 或者: </p><p style="text-indent: 2em;";> ServletConfig config=getServletConfig(); </p><p style="text-indent: 2em;";> ServletContext application=vletContext(); </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>22、简述数据库连接池的实现原理。 </p><p style="text-indent: 2em;";>答:(1) 预先创建一定数量的连接,存放在连接池中。 </p><p style="text-indent: 2em;";> (2) 当程序请求一个连接时,连接池是为该请求分配一个空闲连接,而不是去重新建立一个连接;当程序使用完连接后,该链接将重新回到连接池中,而不是直接将连接释放。 </p><p style="text-indent: 2em;";> (3) 当连接池中的空闲连接数量低于下限时,连接池将根据管理机制追加创建一定数量的连接;当空线连接数量高于上限时,连接池将释放一定数量的连接。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>23、forward和redirect的区别 </p><p style="text-indent: 2em;";>答:forward是服务器请求资源,服务器直接访问目标地址的URL,把那个URL的响应内容读取过来,然后把这些内容再发给浏览器,浏览器根本不知道服务器发送的内容是从哪儿来的,所以它的地址栏中还是原来的地址。 </p><p style="text-indent: 2em;";>redirect就是服务端根据逻辑,发送一个状态码,告诉浏览器重新去请求那个地址,一般来说浏览器会用刚才请求的所有参数重新请求,所以session,request参数都可以获取。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>24、有两个页面和,要从传值到有几种方法?分别是什么? </p><p style="text-indent: 2em;";>答:(1) 最常用的方法是用form中的text,<input type=text name=username value=admin>,然后在页面中这样获取:String username=ameter("username"); </p><p style="text-indent: 2em;";> (2) 直接在Url地址栏里面输入第一个页面的地址,在后加问号,然后把要传的参数及值写在后面,如有多个用&隔开,然后在下一页面用:ameter("参数名")来获取。 </p><p style="text-indent: 2em;";> 如:在中可用这样获取: </p><p style="text-indent: 2em;";> String username=ameter("username"); </p><p style="text-indent: 2em;";> String username=ameter("password"); </p><p style="text-indent: 2em;";> (3) 在form中放hidden,如:<input type=hidden name=username value=admin>,获取方法同上。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>25、JSP页面是如何被执行的?JSP执行效率比Servlet低吗? </p><p style="text-indent: 2em;";>答:当客户端向一个JSP页面发出请求时,Web Container将JSP转化成Servlet的源代码(只在第一次请求时),然后编译转化后的Servlet并加载到内存中执行,执行的结果Response到客户端。 </p><p style="text-indent: 2em;";>JSP只在第一次执行的时候会转化为Servlet,以后每次执行Web容器都是直接执行编译后的Servlet,所以JSP和Servlet只是在第一次执行的时候不一样,JSP慢一点,以后的执行都是相同的。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>26、HttpServlet类中的主要方法都有哪些? </p><p style="text-indent: 2em;";>答:HttpServlet的主要方法有 doGet, doPost, doPut, doDelete, doTrace等等。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>27、JSP 和 Servlet 有哪些相同点和不同点,他们之间的联系是什么? </p><p style="text-indent: 2em;";>答:JSP 是 Servlet 技术的扩展,本质上是 Servlet 的简易方式,更强调应用的外表表达。JSP 编译后是"类 servlet"。Servlet 和 JSP 最主要的不同点在于,Servlet 的应用逻辑是在 Java 文件中,并且完全从表示层中的 HTML 里分离开来 。而 JSP 的情况是 Java 和 HTML 可以组合成一个扩展名为.jsp 的文件。 JSP 侧重于视图,Servlet 主要用于控制逻辑。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>五、编程题 </p><p style="text-indent: 2em;";>01、请依次写出下面表单对象的HTML代码。 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";><input type="text" name="textfield"> </p><p style="text-indent: 2em;";> 20 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";><input type="radio" name="radiobutton" value="radiobutton"> </p><p style="text-indent: 2em;";><input type="checkbox" name="checkbox" value="checkbox"> </p><p style="text-indent: 2em;";><select name="select"> </p><p style="text-indent: 2em;";> <option selected>aaa</option> </p><p style="text-indent: 2em;";> <option>bbb</option> </p><p style="text-indent: 2em;";> <option>ccc</option> </p><p style="text-indent: 2em;";></select> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>02、提交表单前验证表单输入是否为空(JavaScript) </p><p style="text-indent: 2em;";><script type="text/javascript"> </p><p style="text-indent: 2em;";>function checkform(){ </p><p style="text-indent: 2em;";> if (=="") </p><p style="text-indent: 2em;";> { alert("用户名不能为空!"); </p><p style="text-indent: 2em;";> return false; } </p><p style="text-indent: 2em;";> else if (=="") </p><p style="text-indent: 2em;";> { alert("密码不能为空!"); </p><p style="text-indent: 2em;";> return false; } </p><p style="text-indent: 2em;";> return true;} </p><p style="text-indent: 2em;";></script> </p><p style="text-indent: 2em;";><form action="" method="post" name="form" onsubmit="return checkform()"> </p><p style="text-indent: 2em;";> 用户名:<input type="text" name="username"/> </p><p style="text-indent: 2em;";> 密码:<input type="password" name="password"/></td> </p><p style="text-indent: 2em;";> <input type="submit" value="提交" /> </p><p style="text-indent: 2em;";></form> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>03、编写一个简单的登录程序,要求登录页面中输入用户名(username)、密码(password),用户点击提交后,验证用户是否输入了用户名、密码。如果用户名为aaa,密码为aaa,则转到登录成功页面,否则显示页面。 </p><p style="text-indent: 2em;";><body> </p><p style="text-indent: 2em;";> <form action=""> </p><p style="text-indent: 2em;";> 用户登录 </p><p style="text-indent: 2em;";> 用户名:<input type="text" name="userName"> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> 密码:<input type="password" name="userPass"> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> <input type="submit" value="登录"> </p><p style="text-indent: 2em;";> <input type="reset" value="重置"> </p><p style="text-indent: 2em;";><% String name=ameter("userName"); </p><p style="text-indent: 2em;";> if(name==null) name=""; </p><p style="text-indent: 2em;";> String password=ameter("userPass"); </p><p style="text-indent: 2em;";> if(password==null) password=""; </p><p style="text-indent: 2em;";> if(name=aaa&&password==aaa) %> </p><p style="text-indent: 2em;";> <jsp:forward page=""> </p><p style="text-indent: 2em;";><% else %> </p><p style="text-indent: 2em;";> <jsp:forward page=""> </p><p style="text-indent: 2em;";></form> </p><p style="text-indent: 2em;";></body> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>04、用Application对象实现一个简单的网页计数器 </p><p style="text-indent: 2em;";><%@page contentType="text/html;charset=GB2312"%> </p><p style="text-indent: 2em;";><HTML><BODY> </p><p style="text-indent: 2em;";><% Integer number=(Integer)ribute("Count"); </p><p style="text-indent: 2em;";> if (number==null) </p><p style="text-indent: 2em;";> { number=new Integer(1); </p><p style="text-indent: 2em;";> ribute("Count",number); } </p><p style="text-indent: 2em;";> else </p><p style="text-indent: 2em;";> { number=new Integer(ue()+1); </p><p style="text-indent: 2em;";> ribute("Count",number); } </p><p style="text-indent: 2em;";>%> </p><p style="text-indent: 2em;";>您是第<%=(Integer)ribute("Count")%>个访问本站的客户。 </p><p style="text-indent: 2em;";></BODY> </p><p style="text-indent: 2em;";> 21 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";></HTML> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>05、编写一个输出"Hello World!"Servlet程序。 </p><p style="text-indent: 2em;";>import .*; </p><p style="text-indent: 2em;";>import t.*; </p><p style="text-indent: 2em;";>import .*; </p><p style="text-indent: 2em;";>//创建一个Servlet类,继承HttpServlet </p><p style="text-indent: 2em;";>public class Hello extends HttpServlet { </p><p style="text-indent: 2em;";> // 重写doGet() </p><p style="text-indent: 2em;";> public void doGet(HttpServletRequest request, HttpServletResponse response) </p><p style="text-indent: 2em;";> throws ServletException, IOException { </p><p style="text-indent: 2em;";> // 设置响应到客户端的文本类型为HTML </p><p style="text-indent: 2em;";> tentType("text/html"); </p><p style="text-indent: 2em;";> // 获取输出流 </p><p style="text-indent: 2em;";> PrintWriter out = ter(); </p><p style="text-indent: 2em;";> n("Hello World"); </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";>} </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>06、编写一个简单的Servlet程序,通过Servlet向浏览器输出文本信息“Servlet简单应用”。要求写出相应的Servlet类及配置文件。 </p><p style="text-indent: 2em;";>public class print extends HttpServlet { </p><p style="text-indent: 2em;";> public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, </p><p style="text-indent: 2em;";>IOException { </p><p style="text-indent: 2em;";> tentType("text/html"); </p><p style="text-indent: 2em;";> PrintWriter out = ter(); </p><p style="text-indent: 2em;";> n("Servlet简单应用"); } </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";>配置文件 </p><p style="text-indent: 2em;";><?xml version="1.0" encoding="UTF-8"?> </p><p style="text-indent: 2em;";><web-app > </p><p style="text-indent: 2em;";> <servlet> </p><p style="text-indent: 2em;";> <servlet-name>MyServlet</servlet-name> </p><p style="text-indent: 2em;";> <servlet-class>print</servlet-class> </p><p style="text-indent: 2em;";> </servlet> </p><p style="text-indent: 2em;";> <servlet-mapping> </p><p style="text-indent: 2em;";> <servlet-name>MyServlet</servlet-name> </p><p style="text-indent: 2em;";> <urlpattern>/textServlet</urlpattern> </p><p style="text-indent: 2em;";> </servlet-mapping> </p><p style="text-indent: 2em;";></web-app> </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>07、第一个Servlet1文件,读取两个请求参数first和second,将其转换为int值后相加,和存放在请求范围内,然后把请求转发第二个Servlet2.。第二个Servlet2文件(url为output),向客户输出Servlet1计算的结果。 </p><p style="text-indent: 2em;";>public class Servlet1 extends HttpServlet { </p><p style="text-indent: 2em;";> public void service(ServletRequest request,ServletResponse response) </p><p style="text-indent: 2em;";> throws ServletException, IOException { </p><p style="text-indent: 2em;";> //读取两个请求参数,并将其转换为int值 </p><p style="text-indent: 2em;";> int first = f(ameter("first")).intValue(); </p><p style="text-indent: 2em;";> int second=f(ameter("second")).intValue(); </p><p style="text-indent: 2em;";> //将两个数字相加 </p><p style="text-indent: 2em;";> int sum=first+second; </p><p style="text-indent: 2em;";> //在request对象中添加sum属性 </p><p style="text-indent: 2em;";> ribute("sum", f(sum)); </p><p style="text-indent: 2em;";> //把请求转发给Servlet2 </p><p style="text-indent: 2em;";> ServletContext context = getServletContext(); </p><p style="text-indent: 2em;";> RequestDispatcher dispatcher =uestDispatcher("/output"); </p><p style="text-indent: 2em;";> d(request, response); </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";>} </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";> 22 </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>public class Servlet2 extends HttpServlet { </p><p style="text-indent: 2em;";> public void service(ServletRequest request,ServletResponse response) </p><p style="text-indent: 2em;";> throws ServletException, IOException { </p><p style="text-indent: 2em;";> //读取请求范围内Servlet1计算出的和 </p><p style="text-indent: 2em;";> String sum=(String)ribute("sum"); </p><p style="text-indent: 2em;";> //向客户端输出和 </p><p style="text-indent: 2em;";> PrintWriter out=ter(); </p><p style="text-indent: 2em;";> ("the sum is "+sum); </p><p style="text-indent: 2em;";> } </p><p style="text-indent: 2em;";>} </p><p style="text-indent: 2em;";> </p><p style="text-indent: 2em;";>08、编写一个JSP页面“”,向该JSP页面的文本框中输入一个数字,单击按钮提交该页面给另一个页面“”进行处理,显示在原页面中输入数字的奇偶性。(如果输入非自然数的字符,请用异常进行处理。) </p><p style="text-indent: 2em;";>【】 </p><p style="text-indent: 2em;";><% String num = (String)ameter("num"); </p><p style="text-indent: 2em;";> try { int n = nt(num); </p><p style="text-indent: 2em;";> if (n%2==0) </p><p style="text-indent: 2em;";> ribute("type","偶数"); </p><p style="text-indent: 2em;";> else </p><p style="text-indent: 2em;";> ribute("type","奇数"); </p><p style="text-indent: 2em;";> uestDispatcher("").forward(request,response); </p><p style="text-indent: 2em;";> } catch(Exception e){ tackTrace(); } </p><p style="text-indent: 2em;";>%> </p><p style="text-indent: 2em;";>【】 </p><p style="text-indent: 2em;";><%@ page contentType="text/html;charset=gb2312" %> </p><p style="text-indent: 2em;";><% String type = (String)ribute("type"); %> </p><p style="text-indent: 2em;";><html> </p><p style="text-indent: 2em;";><head><title>页面一

请输入一个数字:

${type }

09、设计Servlet代码实现以post方法获取参数password参数的功能,并将此参数值放置在请求对象中,同时完成对表单多选框jobs参数值的读取和显示。

import javax. servlet.*;

import javax. .*;

public class Servlet1 extends 【HttpServlet】

{ public void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

String password= ameter("password");

request.【setAttribute】("password", password);

String jobs[]=request. getParameterValues("jobs") ;

for(int i;i

("jobs="+jobs[i]); }

} }

10、编写jsp程序完成网页计数器的设计。要求: 完成后台java bean的网页计数器设计,其中计数器的值保存在文件中,文件调用计数器显示在浏览器中。

【】

public class counter extends Object {

private String currentRecord = null; //保存文本的变量

private BufferedReader file; //BufferedReader对象,用于读取文件数据

private String path; //文件完整路径名

public counter() { }

//ReadFile方法用来读取文件filePath中的数据,并返回这个数据

23

public String ReadFile(String filePath) throws FileNotFoundException

{ path = filePath;

file = new BufferedReader(new FileReader(path)); //创建新的BufferedReader对象

String returnStr =null;

try

{ currentRecord = ne();//读取一行数据并保存到currentRecord变量中

} catch (IOException e) { n("读取数据错误."); }

if (currentRecord == null)

returnStr = "没有任何记录";

else

{ returnStr =currentRecord; }

return returnStr; //返回读取文件的数据

}

//ReadFile方法用来将数据counter+1后写入到文本文件filePath中

//以实现计数增长的功能

public void WriteFile(String filePath,String counter) throws FileNotFoundException

{ path = filePath;

int Writestr = nt(counter)+1;

try { PrintWriter pw = new PrintWriter(new FileOutputStream(filePath));

n(Writestr);

();

} catch(IOException e) { n("写入文件错误"+sage()); }

}

}

【】

< !--创建并调用bean(counter)-- >

< jsp:useBean id="counter" class="counter" scope="request" >

< /jsp:useBean >

< % String cont=le("/");

ile("/",cont); % >

您是第< font color="red" >< %=cont% >< /font >位访问者

11、Access数据库中有数据表biao(编号(自动编号),name(c20)),要求不设置数据源,采用JDBC_ODBC方式连接数据库显示表中的所有内容。

<% // ******* 数据库连接代码 开始 *****

try //异常处理语句

{ String spath = "";//Access 数据库路径

String dbpath = lPath(spath);//转化成物理路径

String dbname = ""; //Acvess 数据库用户名,没有则为空

String user = ""; //Access 数据库密码,没有则为空

//数据库连接字符串

String url ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="+dbpath;

//加载驱动程序

e("bcDriver");

//建立连接

Connection conn= nection(url);

//创建语句对象

Statement stmt=Statement(_SCROLL_SENSITIVE,_UPDATABLE);

// **** 数据库连接代码 结束 ******

//********* 测试数据代码开始 ******

String sql = "select * from biao";

ResultSet rs = eQuery(sql);

while(())

{ int vid=("编号");

("记录:" +vid+ing("name");

}

("

恭喜你!数据库连接成功!");

(); //关闭记录集对象

24

(); //关闭语句对象

(); //关闭连接对象

} catch(Exception e){ (sage()); }

%>

12、编写简单的Servlet程序,通过页面从文框框输入圆的半径,提交后由Servlet中的处理求出圆面积,并转回输出结果。

【】

<% if(ribute("rt")!=null)

(ribute("rt"));

%>

【】

package bao;

// import … 此处略

public class circleArea extends HttpServlet {

public circleArea() { super(); }

public void destroy() { y(); }

public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,

IOException {

String radius=ameter("r");

double s=3.14*ouble(radius)*ouble(radius);

ribute("rt", s+"");

uestDispatcher("").forward(request, response);

}

13、下面是一个简单的Jsp注册程序的部分代码,请编写注册类的JavaBean代码,完成对注册信息的验证,其中要求用户名是6-15位字母或数字,年龄必须是数字。

【:注册页面】

<%@page import="er"%>

用户名:">

年龄:">

【:验证输入的信息页面】

<% if(date()){ %>

<% }else{ %>

<% } %>

【:注册成功显示页面】

login success!!!

用户名:

【注册类JavaBean代码】

package Testbean;

public class Register {

private String name;

private String age;

private String error;

25

//注册方法

public Register()

{ ="";

="";

=""; }

//注册数据验证

public boolean isValidate()

{ boolean flag=true;

if(!s("w{6,15}"))

{ flag=false;

="";

="用户名必须为6到15位字母或数字!";

}

if(!s("d+"))

{ flag=false;

="";

="年龄只能为数字";

}

return flag;

}

public String getAge() { return age; }

public void setAge(String age) { =age; }

public String getName() { return name; }

public void setName(String name) { =name; }

}

14、编写自定义标签,并调用该标签显示当前的系统日期和系统时间。要求写出标签类(继承自TagSupport)、标签库表述文件并写出JSP页面引用自定义的标签显示系统日期和系统时间。

package com;

import .*;

import .*;

inport .*;

public class ShowData extends TagSurpport{

public int doStartTag() throws JspException{

JspWriter out=();

try{

Data dt=new Data();

data=new (e());

(data);

}catch(Exception e){

n("显示系统日期时出现异常:")+sage());}

return(SKIP_BODY);}}

标签库中表述文件:

显示当前日期

showData

ta

empty

在中加入自定义标签库的引用:

showDataUri

/WEB-INF/

在页面中引用

<%@ page language="java" pageEncoding="GBK"%>

<%@ taglib uri="showDataUri" prefix="wghData"%>

自定义标签的应用

今天是

26

15、在Ajax技术之中,最核心的技术就是XMLHttpRequest,为了提高程序的兼容性,请创建一个跨浏览器的XMLHttpRequest对象。

if (pRequest)

{ http_request=new XMLHttpRequest(); }

else if (XObject) {

try {

http_request=new ActiveXObject(“P”);

} catch(e) {

try {

http_request=new ActiveXObject(“P”);

} catch (e) { }

}

}

16、假设创建Servlet的类是,创建的Servlet对象的名 字是myservlet,应当怎样配置文件?

myservlet

27


本文标签: 页面 对象 方法 请求 数据