热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

jsp在线考试系统-jsp文件_MySQL

一个在线考试系统,测试你的jsp知识,代码不是特别多,所以不加注释了(jspbbs.yeah.net)answer.jsp%--Includedirective--%%@includefileheader.html%TABLEBORDER0CELLPADDING0CELLSPACING0TRTDVALIGNTOPFONTFACEVerdana,Arial,Helveti
  一个在线考试系统,测试你的jsp知识,代码不是特别多,所以不加注释了(http://jspbbs.yeah.net)

answer.jsp

<%-- Include directive --%>
<%@ include file="header.html" %>





JSP Professional, Chapter 12 Quiz
Answers


by Dan Malks







<%-- The method getOne() was set up in the bean with the id "worker" --%>
<%-- All Java code is enclosed in <% %>, leaving HTML to be easily --%>
<%-- changed or updated. --%>

<% if((worker.getOne() != null) && ((worker.getOne()).equals("D"))) { score ++; %>




<% } else if (worker.getOne() != null) { %>




<% } else { %>



<% } %>









<% if ((worker.getTwo() != null) && ((worker.getTwo()).equals("B"))) { score ++; %>




<% } else if (worker.getTwo() != null) { %>



<% } else { %>


<% } %>








<% if ((worker.getThree() != null) && ((worker.getThree()).equals("D"))) { score ++; %>




<% } else if (worker.getThree() != null) { %>



<% } else { %>


<% } %>








<% if ((worker.getFour() != null) && ((worker.getFour()).equals("C"))) { score ++; %>




<% } else if (worker.getFour() != null) { %>



<% } else { %>



<% } %>








<% if ((worker.getFive() != null) && ((worker.getFive()).equals("A"))) { score ++; %>




<% } else if (worker.getFive() != null) { %>



<% } else { %>


<% } %>








<% if ((worker.getSix() != null) && ((worker.getSix()).equals("B"))) { score ++; %>




<% } else if (worker.getSix() != null) { %>



<% } else { %>



<% } %>








<% if ((worker.getSeven() != null) && ((worker.getSeven()).equals("B"))) { score ++; %>




<% } else if (worker.getSeven() != null) { %>



<% } else { %>


<% } %>








<% if ((worker.getEight() != null) && ((worker.getEight()).equals("A"))) { score ++; %>




<% } else if (worker.getEight() != null) { %>



<% } else { %>


<% } %>








<% if ((worker.getNine() != null) && ((worker.getNine()).equals("A"))) { score ++; %>




<% } else if (worker.getNine() != null) { %>



<% } else { %>


<% } %>








<% if ((worker.getTen() != null) && ((worker.getTen()).equals("D"))) { score ++; %>




<% } else if (worker.getTen() != null) { %>



<% } else { %>


<% } %>


<%-- Scoring calculations --%>
<%
int missed = 10 - score;
double grade = (double)score/10*100;
%>




<%-- Page directive that applies to entire page. --%>
<%@ page language="java" %>

<%-- Identifies bean as "worker" and tells the page where to locate the bean. --%>


<%-- Set bean properties with a wildcard. --%>



<%-- Scoring --%>

<%-- Variable declaration in code scriptlet -->
<% int score = 0; %>





1. D
is correct!

is incorrect!
Blank X
Every JavaServer PagesTM
(JSP)TMsource page is compiled into
a servlet before it is executed at runtime.

2. B
is correct!

is
incorrect

Blank
X

When large amounts of Java scriptlet code are mixed with HTML markup
within a JSP page, not only do readability and reuse suffer, but often
bugs are introduced as web-production team members, who may not be
familiar with Java programming, need to modify the accompanying markup.
Additionally, dependencies now exist among various teams competing for the
same file, making the development process less efficient.

3. D
is correct!

is
incorrect

Blank X

Doing an HTTP redirect requires a round-trip to the client. If this
is not required, and the only desire is to forward the request to
another resource, then this can be much more efficiently accomplished
with the RequestDispatcher. Additionally, when using the
dispatcher the state of the request object is maintained between
resources, which will not be the case with the HTTP redirect.

4. C
is correct!

is
incorrect

Blank X

Business logic is better contained in a
JavaBeanTM or a servlet, which is
owned by a software developer. When lots of Java code is embedded
directly within the JSP page as scriptlets, the
"cut-and-paste" mentality tends to prevail when it comes
to code reuse.

5.
A is correct!

is
incorrect

Blank X

Since the servlet is the initial contact point for each request, it is
well-suited to handle logic that is common across multiple requests.
A good example of this type of logic is an authentication check.

6.
B is correct!

is
incorrect

Blank X

Using a business delegate reduces coupling between the presentation
and business tiers. The presentation tier has no knowledge of the
EJB implementation details, such as Java Naming and Directory
InterfaceTM lookup.

7.
B is correct!

is
incorrect

Blank X

Using Java scriptlets is the accepted method of doing iteration in
JSPTM 1.0. In
JSPTM 1.1, a custom tag may be used,
which will hide the implementation details of the iteration code.

8.

A is correct!

is
incorrect
Blank
X

The term Page-Centric is used to describe an architecture where
the initial contact point for the request is a JSP page. An example
is shown visually below:


JSP Page-Centric

9.

A is correct!

is
incorrect

Blank X

When the forward method is used, the invoking resource does not regain
control. Multiple include invocations can be made from the same
resource, while the invoking resource maintains execution control.

10.
D is correct!

is
incorrect

Blank X

Error pages are invoked when there is an uncaught exception from
within a particular page. In this case, we mention that the
validationGaurd() method might throw an exception.
If this exception is not caught within the page, then we vector
control to the errorPage, as stipulated in the attribute
of the given page directive.



You missed <%= missed %>

Your score is <%= (int)grade %> percent.

Source Code


This quiz used the Page-View with Bean Approach, detailed in HREF="/developer/Books/javaserverpages/">Chapter 12, JSP Archeticure. The first
page
of the quiz consists of regular HTML with a form that calls HREF="answer.txt">answer.jsp. Answer.jsp requests parameters from the bean,
in this case, called QuizResponses. The page-view with bean
approach for this quiz required extra work to write the bean, and it could have been done using the
page-view approach without a bean, requesting invocation directly from the answer.jsp
page. Deciding which approach is preferrable depends on the application and how much HTML and Java
scriptlets need to be used. For this quiz we opted for the page-view with bean approach for
illustration purposes.

Back to Quiz







<%@ include file="footer.html" %>

推荐阅读
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • Lodop中特殊符号打印设计和预览样式不同的问题解析
    本文主要解析了在Lodop中使用特殊符号打印设计和预览样式不同的问题。由于调用的本机ie引擎版本可能不同,导致在不同浏览器下样式解析不同。同时,未指定文字字体和样式设置也会导致打印设计和预览的差异。文章提出了通过指定具体字体和样式来解决问题的方法,并强调了以打印预览和虚拟打印机测试为准。 ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • IhaveconfiguredanactionforaremotenotificationwhenitarrivestomyiOsapp.Iwanttwodiff ... [详细]
  • Python字典推导式及循环列表生成字典方法
    本文介绍了Python中使用字典推导式和循环列表生成字典的方法,包括通过循环列表生成相应的字典,并给出了执行结果。详细讲解了代码实现过程。 ... [详细]
  • 本文讨论了在Windows 8上安装gvim中插件时出现的错误加载问题。作者将EasyMotion插件放在了正确的位置,但加载时却出现了错误。作者提供了下载链接和之前放置插件的位置,并列出了出现的错误信息。 ... [详细]
  • “你永远都不知道明天和‘公司的意外’哪个先来。”疫情期间,这是我们最战战兢兢的心情。但是显然,有些人体会不了。这份行业数据,让笔者“柠檬” ... [详细]
  • 本文讨论了使用差分约束系统求解House Man跳跃问题的思路与方法。给定一组不同高度,要求从最低点跳跃到最高点,每次跳跃的距离不超过D,并且不能改变给定的顺序。通过建立差分约束系统,将问题转化为图的建立和查询距离的问题。文章详细介绍了建立约束条件的方法,并使用SPFA算法判环并输出结果。同时还讨论了建边方向和跳跃顺序的关系。 ... [详细]
  • 生成对抗式网络GAN及其衍生CGAN、DCGAN、WGAN、LSGAN、BEGAN介绍
    一、GAN原理介绍学习GAN的第一篇论文当然由是IanGoodfellow于2014年发表的GenerativeAdversarialNetworks(论文下载链接arxiv:[h ... [详细]
  • [译]技术公司十年经验的职场生涯回顾
    本文是一位在技术公司工作十年的职场人士对自己职业生涯的总结回顾。她的职业规划与众不同,令人深思又有趣。其中涉及到的内容有机器学习、创新创业以及引用了女性主义者在TED演讲中的部分讲义。文章表达了对职业生涯的愿望和希望,认为人类有能力不断改善自己。 ... [详细]
  • 本文介绍了在Win10上安装WinPythonHadoop的详细步骤,包括安装Python环境、安装JDK8、安装pyspark、安装Hadoop和Spark、设置环境变量、下载winutils.exe等。同时提醒注意Hadoop版本与pyspark版本的一致性,并建议重启电脑以确保安装成功。 ... [详细]
  • Android Studio Bumblebee | 2021.1.1(大黄蜂版本使用介绍)
    本文介绍了Android Studio Bumblebee | 2021.1.1(大黄蜂版本)的使用方法和相关知识,包括Gradle的介绍、设备管理器的配置、无线调试、新版本问题等内容。同时还提供了更新版本的下载地址和启动页面截图。 ... [详细]
author-avatar
汽车一族coolboy_518
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有