JSP期末考试题Word文档下载推荐.doc

上传人:wj 文档编号:1243930 上传时间:2023-04-30 格式:DOC 页数:16 大小:94.50KB
下载 相关 举报
JSP期末考试题Word文档下载推荐.doc_第1页
第1页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第2页
第2页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第3页
第3页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第4页
第4页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第5页
第5页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第6页
第6页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第7页
第7页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第8页
第8页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第9页
第9页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第10页
第10页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第11页
第11页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第12页
第12页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第13页
第13页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第14页
第14页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第15页
第15页 / 共16页
JSP期末考试题Word文档下载推荐.doc_第16页
第16页 / 共16页
亲,该文档总共16页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

JSP期末考试题Word文档下载推荐.doc

《JSP期末考试题Word文档下载推荐.doc》由会员分享,可在线阅读,更多相关《JSP期末考试题Word文档下载推荐.doc(16页珍藏版)》请在冰点文库上搜索。

JSP期末考试题Word文档下载推荐.doc

8)在Servlet过滤器的生命周期方法中,每当传递请求或响应时,web容器会调用()方法。

a)init b)service

c)doFilter d)destroy

9)在JSP中,只有一行代码:

%=’A’+’B’%>

,运行将输出()。

a)A+B b)AB

c)131 d)错误信息,因为表达式是错误的

10)给定一个Servlet的代码片段如下:

PublicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)

throwsServletException,IOException{

______

out.println(“hikitty!

”);

out.close();

}

运行次Servlet时输出如下:

hikitty!

则应在此Servlet下划线处填充如下代码。

(选项一项)

a) PrintWriterout=response.getWriter();

b) PrintWriterout=request.getWriter();

c) OutputStreamout=response.getOutputStream();

d) OutputStreamout=request.getWriter();

11)给定如下JSP代码,假定在浏览器中输入URL:

http:

//localhost:

8080/web/jsp1.jsp,可以调用这个JSP,那么这个JSP的输出是()。

%@pagecontentType="

text/html;

charset=GBK"

%>

%@tagliburi=”prefix=”c”%>

html>

body>

%intcounter=10;

c:

iftest=”${counter%2==1}”>

setvar=”isOdd”value=”true”>

/c:

set>

if>

choose>

whentest=”${isOdd==true}”>

it’sanodd<

when>

otherwise>

it’saneven<

/body>

/html>

a) 一个HTML页面,页面上显示it’sanodd

b) 一个HTML页面,页面上显示it’saneven

c) 一个空白的HTML页面

d) 错误信息

12)给定java程序User.java,代码如下:

packageuser;

publicclassUser{

privateStringpassword;

privateStringloginName;

publicStringgetLoginName(){

returnloginName;

}

publicStringgetPassword(){

returnpassword;

publicvoidsetLoginName(StringloginName){

this.loginName=loginName;

publicvoidsetPassword(Stringpassword){

this.password=password;

给定user.jsp,代码片断如下:

____________

loginName:

<

getPropertyname=”user”property=”loginName”/>

password:

getPropertyname=”user”property=”password”/>

在浏览器上输入URL:

//localhost/user,jsp?

loginName=sa&

password=sa并回车

要使浏览器上显示:

sa password:

sa

在user.jsp中的下划线处应填入以下()代码. (选择一项)

a) <

useBeanid=”user”class=”user.User”scope=”page”/>

setPropertyname=”user”property=”loginName”value=”*”/>

setPropertyname=”user”property=”password”value=”*”/>

b) <

useBeanid=”user”class=”user.User”scope=”application”/>

c) <

useBeanid=”user”class=”user.User”scope=”application”/>

setPropertyname=”user”property=”*”/>

d) <

useBeanid=”user”class=”user.User”scope=”page”/>

13) 某JSP程序中声明使用javaBean的语句如下:

useBeanid=”user”class=”mypackage.User”scope=”pge”/>

要取出该javaBean的loginName属性值,以下语句正确的是(). (选择两项)

a) <

getPropertyname=”user”property=”loginName’/>

b) <

getPropertyid=”user’property=”loginName”/>

c) <

%=user.getLoginName()%>

d) <

%=user.getProperty(“loginName”)%>

14)J2EE中,以下关于HttpServlet的说法错误的是()。

a) HttpServlet是一个抽象类

b) HttpServlet类扩展了GenericServlet类

c) HttpServlet类的子类必须至少重写service方法

d) HttpServlet位于javax.servlet.http包中

15) 给顶一个JSP程序源代码,如下:

includepage="

two.jsp"

flush="

true"

>

paramname="

location"

value="

bejing"

/>

/jsp:

include>

在two.jsp中使用()代码片段可以输出参数location的值。

getParamname="

getParametername="

%=request.getAttribute("

)%>

%=request.getParameter("

16) J2EE中,JSPEL表达式:

s{(10*10)ne100}的值是()。

(选择一项)

a) 0 b) True

c) False d) 1

17)在J2EE中,test.jsp文件如下:

%{%>

useBean id="

buffer"

scope="

page"

type="

java.lang.StringBuffer"

% buffer.append("

ABC"

);

%>

%}%>

buffer is<

%=buffer%>

运行时,将发生()。

a) 转译期错误 b) 运行期错误

c) 运行后,浏览器上显示:

bufferisnull

d) 运行后,浏览器上显示:

bufferisABC

18)如JSP页面执行时遇到自定义标签,doStartTag()方法将被调用()次。

a)1 b)1或多

c)0或1 d)0或多

19)给定include1.jsp文件代码片断,如下:

<

%pageContext.setAttribute("

User"

"

HAHA"

_______//此处填写代码

给定include2.jsp文件代码片断,如下:

%=pageContext.getAttribute("

要求运行include1.jsp时,浏览器上输出:

HAHA

要满足以上条件,jsp1.jsp中下划线处应填入以下()语句。

a)<

include2.jsp"

b)<

%@includefile="

c)<

forwordpage="

d)<

%response.sendRedirect("

20)在J2EE中,在web.xml中,有如下代码:

session-config>

session-timeout>

30<

/session-timeout>

/session-config>

上述代码定义了默认的会话超时时长,时长为30()。

(选择一项)

a)毫秒 b)秒

c)分钟 d)小时

21)在inc.jsp中包含数行代码与一张图片,现在要创建一个home.jsp,每次浏览home.jsp时都能够以最快的速度显示inc.jsp中的所有内容以及home.jsp自身要显示的内容,应该在home.jsp中使用的语句是()。

a)<

%@includefile=“inc.jsp”%>

b)<

%@includepage=“inc.jsp”flush=“true”>

c)<

includefile=“inc.jsp”flush=“false”>

d)<

forwardpage=“inc.jsp”/>

22)给定一个JSP程序源码如下:

includepage=“two.jsp”flush=“true”>

paramname=“location”value=“beijing”/>

在two.jsp中加入()代码片断可以输出参数location的值。

getParamname=“location”>

b)<

getParametername=“location”>

%=request.getAttribute(“location”)%>

d)<

%=request.getParameter(“location”)%>

23)使用自定义标签时,要为JSP引擎提供有关自定义标签的相关信息,下列信息描述语句正确的是()。

tag>

name>

hello<

/name>

tag-class>

com.tagdemo.HelloTag<

/tag-class>

/tag>

b)<

taglib>

/taglib>

tag-info>

tagclass>

/tagclass>

/tag-info>

d)<

tag-desc>

/tag-desc>

24)要设置某个JSP页面为错误处理页面,以下page指令正确的是()。

(选择一项)

a) <

%@pageerrorPage="

b) <

%@pageisErrorPage="

%@pageextends="

javax.servlet.jsp.JspErrorPage"

d)<

%@pageinfo="

error"

25)JavaMail是一组用于发送和接收邮件消息的API。

发送邮件使用()协议,接收邮件使用()协议。

a) POP3SMTP b) POP3TCP

c) SMTPTCP d) SMTPPOP3

26)在Servlet里,能正确获取session的语句是()。

a) HttpSessionsession=request.getSession(true);

b) HttpSessionsession=request.getHttpSession(true);

c) HttpSessionsession=response.getSession(true);

d) HttpSessionsession=response.getHttpSession(true);

27)在JSP中,()动作用于将请求转发给其他JSP页面。

a) forward b) include

c) useBean d) setProperty

28)在J2EE中,在一个JSP文件中,有表达式<

%=2+3%>

,它将输出()。

a) 2+3 b)5

c) 23 d)不会输出,因为表达式是错误的

29)在J2EE实现企业级应用开发中,()是描述标记库的XML文档。

a)TLD文件 b)DTD文件

c ) WAR文件 d)EAR文件

30)给定JSP程序源码如下,可以在下划线处插入并且能够正确输出WELCOME,JACK的语句是()。

(选择二项)

%Stringname="

JACK"

;

WELCOME,______

a) name b) <

%=name%>

c) out.println(name);

d) <

%out.println(name);

31)在J2EE中,重定向到另一个页面,以下()语句是正确的。

a) request.sendRedirect("

//www.jb-"

b) request.sendRedirect();

c) response.sendRedirect("

d) response.sendRedirect();

32)在JSP中,使用<

useBean>

动作可以将javaBean嵌入JSP页面,对JavaBean的访问范围不能是()。

a) page b) request

c) response d) application

33)在J2EE中,使用Servlet过滤器时,可以在web.xml文件的()元素中包括<

init-param>

元素。

a) <

filter>

b) <

filter-mapping>

filter-name>

d) <

filter-class>

34)Servlet中,使用()接口中定义的()方法来处理客户端发出的表单数据请求(选一项)

a)HttpServletdoHead b)HttpServletdoPost

c)ServletRequestdoGet d)ServletRequestdoPost

35)给定JSP程序源码如下,该JSP运行后输出的结果是()。

<

%intcount=1;

Count:

<

%++count;

a)Count:

1 b)Count:

2

c)1:

2 d)Count:

36)给定如下Servlet代码,假定在浏览器中输入URL:

8080/servlet/HelloServlet,可以调用这个servlet,那么这个Servlet的输出是()。

importjava.io.*;

importjavax.servlet.*;

importjavax.servlet.http.*;

publicclassHelloServletextendsHttpServlet{

publicvoidservice(HttpServletRequestreq,HttpServletResponseres)

throwsServletException,IOException{

}

publicvoiddoGet(HttpServletRequestreq,HttpServletResponseres)

throwsServletException,IOException{

res.setContentType("

text/html"

PrintWriterout=res.getWriter();

out.println("

"

doGetHelloWorld!

out.close();

publicvoiddoPost(HttpServletRequestreq,HttpServletResponseres)

doPostHelloWorld!

}(选择一项)

a)一个HTML页面,页面上显示doGetHelloWorld!

b)一个HTML页面,页面上显示doPostHelloWorld!

c)一个空白的HTML页面

d)错误信息

37)在J2EE中,request对象的()方法可以获取页面请求中一个表单组件对应多个值时的用户的请求数据。

a)StringgetParameter(Stringname)

b)String[]getParameter(Stringname)

c)StringgetParameterValuses(Strin

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

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2