职场文秘网

首页 > 心得体会 > 学习材料 / 正文

JavaWeb期末考试A卷

2020-11-28 02:43:08

 XX职业技术学院2013-2014 学年1学期《JavaWeb技术》 考试试卷A卷 专业班级:

  学号

  姓名

 考试形式:开卷

  一、单项选择题(每小题2分,共30分) 1.在JSP中,要定义一个方法,需要用到以下()元素。

 a)

 <%=

 %>

  b)

 <%

  %> c)

 <%!

 %>

 d)

 <%@

 %>

  2. JSP页面经过编译之后,将创建一个()。

 a)

 applet

  b)

 servlet c)

 application

  d)

 exe文件

  3. Servlet中,HttpServletResponse的()方法用来把一个Http请求重定向到另外的URL。

 a)

  sendURL()

  b)

  redirectURL() c)

  sendRedirect()

 d)

  redirectResponse()

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

 a)

  init

  b)

 service c)

 doFilter

 d)

 destroy

 5. 给定一个Servlet的代码片段如下:

  Public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{

 ______ out.println(“hi kitty!”); out.close(); } 运行次Servlet时输出如下:

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

 a) PrintWriter out = response.getWriter();

 b) PrintWriter out = request.getWriter();

 c) OutputStream out = response.getOutputStream(); d) OutputStream out = request.getWriter();

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

  a) HttpServlet是一个抽象类

 b) HttpServlet类扩展了GenericServlet类

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

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

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

  <jsp:include page=“two.jsp“ flush=“true“>

 <jsp:param name=“location“ value=“bejing“/>

 </jsp:include>

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

  a) <jsp:getParam name=“location“>

 b) <jsp:getParameter name=“location“>

 c) <%=request.getAttribute(“location“)%>

 d) <%=request.getParameter(“location“)%> 8、J2EE中,JSP EL表达式:s{(10*10) ne 100}的值是()。

 a) 0

  b) True

 c) False

 d) 1

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

  <% pageContext.setAttribute(“User“,“HAHA“);%>

 _______//此处填写代码

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

  <%=pageContext.getAttribute(“User“)%>

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

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

  a)

  <jsp:include page=“include2.jsp“ flush=“true“/>

 b)

  <%@ include file=“include2.jsp“%>

 c)

  <jsp:forword page=“include2.jsp“/>

 d)

  <% response.sendRedirect(“include2.jsp“);%>

  10. 在J2EE中,在web.xml中,有如下代码: <session - config>

 <session - timeout>30</session - timeout> </session - config> 上述代码定义了默认的会话超时时长,时长为30(

 )。

  一、 毫秒

  b) 秒 c)

 分钟

  d) 小时

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

 )。

  a) <%@include file = “inc.jsp”%>

  b)<%@include page=“inc.jsp”flush= “true”> c) <jsp:include file = “inc.jsp”flush = “false”> d) <jsp:forward page = “inc.jsp”/>

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

  a)

 HttpSession session = request.getSession(true); b)

 HttpSession session = request.getHttpSession(true); c)

 HttpSession session = response.getSession(true); d)

 HttpSession session = response. getHttpSession (true);

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

 )。

  <html>

  <% int count =1;%> Count: <% ++count; %> </html> a)

 Count:1

 b)

 Count:2 c)

 1:2

  d)

 Count:

  14. 在J2EE中,request对象的(

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

 a) String getParameter(String name) b) String[] getParameter(String name) c) String getParameterValuses(String name) d) String[] getParameterValues(String name)

  15. 在J2EE中,以下不是JSP隐式对象的是()。

 a)

 pageContext

  b)

 context c)

 application

  d)

 out

  二、填空题(每题2分,共10分) 1、  Tomcat服务器的默认端口是

 。

 2、 JSP开发网站的两种模式分为________________和

  。

 3、 浏览器向服务器提交请求常用的方式是:

  、

 。

 4、 Web开发中常用的会话技术有哪两种:

 、

 。

 5、 JSP页面的三大指令:

 、

 、

  。

  三、简答题(每题10分,共20分) 1、JSP有哪些内置对象?作用分别是什么? 2、简述Servlet的生命周期。

  四、说明题(每题10分,共20分) 1、简述JSP的运行原理。

 2、简述MVC设计模式。

 (画图加部分文字说明)

  命题教师:

  安露明

 使用班级:

  Java12315

  教研室主任(签字):

  系主任(签字):

 ………………………………………………………………装…………………………………订…………………………………线………………………………………………

 五、编程题(共20分) 采用Servlet+JSP+JavaBean的模式,模拟网站登录页面。

 要求:

 (1) 写出JavaBean的设计代码;(5分) (2) 写出Servlet的代码和web.xml文件中Servlet的配置代码(10分) (3) 写出JSP页面的代码,若成功登录,则页面显示:”XXX”登录成功。(5分)

 四川工商职业技术学院2013-2014 学年1学期《JavaWeb技术》

 考试A卷答卷 专业班级:

  学号

  姓名

 一、单项选择题(每小题2分,共30分)

 1、 2、 3、 4、 5、 6、 7、 8、 9、 10、 11、 12、 13、 14、 15、

 二、填空题(每题2分,共10分) 1、 2、 3、 4、 5、 三、简答题(每题10分,共20分) 1、JSP内置对象,各有什么作用

  2、什么是Servlet的生命周期

 命题教师:

  安露明

 使用班级:

  Java12315

  教研室主任(签字):

  系主任(签字):

 ………………………………………………………………装…………………………………订…………………………………线………………………………………………

 四、说明题(每题10分,共20分) 1、简述JSP运行原理

  2、简述MVC设计模式

  五、编程题(20分)

 

Tags: 期末考试   JavaWeb  

搜索
网站分类
标签列表