题目
选项A
选项B
选项C
选项D
答案
录题人
下列关于Java中Servlet的说法正确的是( )
Servlet 的 init()方法用来实例化一个Servlet
如果请求一个Servlet,则容器调用它的service()方法处理请求
Servlet的destroy()方法在响应结束时被调用
service()方法默认的实现是调用doGet()方法
B
在用户登陆jsp页面上,编写了小脚本将已登陆的用户信息存放在session中,代码如 下所示,那么在其他页面上进行访问控制的代码应是
if(username==null){ response.sendRedirect(“login.html”);}
if(username.equals(“”)){ response.sendRedirect(“login.html”);}
String name = session.getAttribut(“username”); if(name.equals(“”)){ response.sendRedirect(“login.html”); }
String name = (String)session.getAttribut(“username”); if(name==null){ response.sendRedirect(“login.html”);}
D
以下哪个不是MVC设计模式的好处
各司其职,互不干涉
利于分工
利于重用和扩展
适合小中型应用程序
D
李蕊
不能在不同用户之间共享数据的方法是( )
通过cookie
利用文件系统
利用数据库
通过ServletContext对象
A
岳勇宏
taglib 指令中 ( ) 属性表示前缀
uri
url
prefix
pre
C
孔繁玉
46.$.get()方法返回内容格式不包括()
xml
html
json
imgage
D
岳勇宏
假设在helloapp 应用中有一个hello.jsp,它的文件路径如下:%CATALINA_HOME%/webapps/helloapp/hello/hello.jsp,那么在浏览器端访问hello.jsp的URL是 ( )
http://localhost:8080/hello.jsp
http://localhost:8080/helloapp/hello.jsp
http://localhost:8080/helloapp/hello/hello.jsp
http://localhost:8080/webapps/helloapp/hello/hello.jsp
C
孔繁玉
jsp处理表单上传,需要设置form的一下哪个属性?
method
action
enctype
get
C
李智
下拉选项中( )可以获取请求页面中一个名称为uname的文本输入框的值
request.getParameter(uname);
request.getPerameter(“uname”);
request.getParameter(“uname”);
request.getParameterValue(“uname”);
C
在使用JSP开发的Web应用程序中,home目录与images目录为同级目录,现在要在home目录下的index.jsp中访问images目录下的图片1.jpg,以下代码片段正确的是
A
JSP 和Java 的关系是()
两种编程语言
JSP隶属于JAVA
JSP 属于Java EE 的一部分
以上都不是
C
李蕊
Http协议的状态码()表示文件没有创建
200
400
500
404
D
李蕊
配置Filter使用的标签是()
和
和
和
和
A
陈建
的执行结果是()
1 2 3 4 5
i i i
1 3 5
15
C
陈建
JSP中的forward和sendredirect都是用来做页面跳转的,关于forward和sendredirect下面说法正确的是( )
forward之后可以使用原来的request对象
sendRedirect之后不可以使用原来的request对象
forward后,地址栏变成新的地址
sendRedirect后,地址栏变成新的地址
A,D
孔繁玉
50.在MVC设计模式中,()处理用户请求,接收请求数据
JSP
JavaBean
Servlet
HTML
C
岳勇宏
如果要修该Tomcat的端口号,需要修改/conf目录下的哪个文件( )
web.xml
server.xml
context.xml
catalima.policy
B
孔繁玉
Filter接口中不包括()
doGet
init
destroy
doFilter
A
陈建
某jsp文件中有以下代码, <% pageContext.setAttribute("a","page"); request.setAttribute("a","request"); session.setAttribute("a","session"); application.setAttribute("a","application"); %> ${a} 则显示的结果为()
page
request
session
application
A
陈建
在JSP中使用标记时,不会出现的属性是:( )
name
property
value
以上皆不会出现
A
岳勇宏
<