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

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

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

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" %>

推荐阅读
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • Nginx使用AWStats日志分析的步骤及注意事项
    本文介绍了在Centos7操作系统上使用Nginx和AWStats进行日志分析的步骤和注意事项。通过AWStats可以统计网站的访问量、IP地址、操作系统、浏览器等信息,并提供精确到每月、每日、每小时的数据。在部署AWStats之前需要确认服务器上已经安装了Perl环境,并进行DNS解析。 ... [详细]
  • 一、Hadoop来历Hadoop的思想来源于Google在做搜索引擎的时候出现一个很大的问题就是这么多网页我如何才能以最快的速度来搜索到,由于这个问题Google发明 ... [详细]
  • Monkey《大话移动——Android与iOS应用测试指南》的预购信息发布啦!
    Monkey《大话移动——Android与iOS应用测试指南》的预购信息已经发布,可以在京东和当当网进行预购。感谢几位大牛给出的书评,并呼吁大家的支持。明天京东的链接也将发布。 ... [详细]
  • 学习SLAM的女生,很酷
    本文介绍了学习SLAM的女生的故事,她们选择SLAM作为研究方向,面临各种学习挑战,但坚持不懈,最终获得成功。文章鼓励未来想走科研道路的女生勇敢追求自己的梦想,同时提到了一位正在英国攻读硕士学位的女生与SLAM结缘的经历。 ... [详细]
  • 生成式对抗网络模型综述摘要生成式对抗网络模型(GAN)是基于深度学习的一种强大的生成模型,可以应用于计算机视觉、自然语言处理、半监督学习等重要领域。生成式对抗网络 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 本文介绍了brain的意思、读音、翻译、用法、发音、词组、同反义词等内容,以及脑新东方在线英语词典的相关信息。还包括了brain的词汇搭配、形容词和名词的用法,以及与brain相关的短语和词组。此外,还介绍了与brain相关的医学术语和智囊团等相关内容。 ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • Echarts图表重复加载、axis重复多次请求问题解决记录
    文章目录1.需求描述2.问题描述正常状态:问题状态:3.解决方法1.需求描述使用Echats实现了一个中国地图:通过选择查询周期&#x ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • IhaveconfiguredanactionforaremotenotificationwhenitarrivestomyiOsapp.Iwanttwodiff ... [详细]
  • Python字典推导式及循环列表生成字典方法
    本文介绍了Python中使用字典推导式和循环列表生成字典的方法,包括通过循环列表生成相应的字典,并给出了执行结果。详细讲解了代码实现过程。 ... [详细]
  • 本文讨论了在Windows 8上安装gvim中插件时出现的错误加载问题。作者将EasyMotion插件放在了正确的位置,但加载时却出现了错误。作者提供了下载链接和之前放置插件的位置,并列出了出现的错误信息。 ... [详细]
author-avatar
艺卓显示、巴可投影
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有