jsp在线考试系统-bean文件

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

answer.jsp

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

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<DIV ALIGN="RIGHT">
<FONT SIZE="-1"><A HREF="/developer/Quizzes/index.html">Quizzes
Index</A></FONT></DIV>
<H2 ALIGN="RIGHT"><FONT COLOR="#FFFFFFF">JSP Professional, Chapter 12 Quiz
Answers</FONT></H2>
<H4 ALIGN="RIGHT"><EM>by Dan Malks</EM></H4>
<BR><BR>
<TABLE BORDER="0" CELLSPACING="8" CELLPADDING="2" <TR><TD>
<FONT FACE="Verdana, Arial, Helvetica, sans-serif">

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

<%-- Identifies bean as "worker" and tells the page where to locate the bean. --%>
<jsp:useBean id="worker" "request" />

<%-- Set bean properties with a wildcard. --%>
<jsp:setProperty name="worker" property="*" />

<%-- Scoring --%>

<%-- Variable declaration in code scriptlet -->
<TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">2.</FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> <B>B</B>
is correct!<BR></FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<FONT COLOR=red><jsp:getProperty name="worker" property="two" /> is
incorrect</FONT></TD>

<% } else { %>
<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Blank
<FONT COLOR=red>X</FONT></FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
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.
</FONT>
</TD></TR>

<!-- Question 3 -->

<TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">3.</FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> <B>D</B>
is correct!<BR></FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<FONT COLOR=red><jsp:getProperty name="worker" property="three" /> is
incorrect</FONT></FONT></TD>

<% } else { %>
<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Blank <FONT COLOR=red>X</FONT></FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
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 <CODE>RequestDispatcher</CODE>. 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.

</FONT></TD></TR>

<!-- Question 4 -->

<TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">4.</TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> <B>C</B>
is correct!<BR></FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<FONT COLOR=red><jsp:getProperty name="worker" property="four" /> is
incorrect</FONT></FONT></TD>

<% } else { %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Blank <FONT COLOR=red>X</FONT></FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Business logic is better contained in a
JavaBean<SUP><FONT SIZE="-2">TM</FONT></SUP> 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
&quot;cut-and-paste&quot; mentality tends to prevail when it comes
to code reuse.
</FONT>
</TD></TR>

<!-- Question 5 -->

<TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">5.</FONT></TD>

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

<TD VALIGN="TOP"> <FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<B>A</B> is correct!<BR></FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<FONT COLOR=red><jsp:getProperty name="worker" property="five" /> is
incorrect</FONT></FONT></TD>

<% } else { %>
<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Blank <FONT COLOR=red>X</FONT></FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
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.
</FONT>
</TD></TR>

<!-- Question 6 -->

<TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">6.</FONT></TD>

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

<TD VALIGN="TOP"> <FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<B>B</B> is correct!<BR></FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<FONT COLOR=red><jsp:getProperty name="worker" property="six" /> is
incorrect</FONT></FONT></TD>

<% } else { %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Blank <FONT COLOR=red>X</FONT></FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
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
Interface<SUP><FONT SIZE="-2">TM</FONT></SUP> lookup.
</FONT>
</TD></TR>

<!-- Question 7 -->

<TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">7.</FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<B>B</B> is correct!<BR></FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<FONT COLOR=red><jsp:getProperty name="worker" property="seven" /> is
incorrect</FONT></FONT></TD>

<% } else { %>
<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Blank <FONT COLOR=red>X</FONT></FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Using Java scriptlets is the accepted method of doing iteration in
JSP<SUP><FONT SIZE="-2">TM</FONT></SUP> 1.0. In
JSP<SUP><FONT SIZE="-2">TM</FONT></SUP> 1.1, a custom tag may be used,
which will hide the implementation details of the iteration code.

</FONT></TD></TR>

<!-- Question 8 -->

<TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">8.
</FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<B>A</B> is correct!<BR></FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<FONT COLOR=red><jsp:getProperty name="worker" property="eight" /> is
incorrect</FONT></FONT></TD>

<% } else { %>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Blank
<FONT COLOR=red>X</FONT></FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
The term <I>Page-Centric</I> is used to describe an architecture where
the initial contact point for the request is a JSP page. An example
is shown visually below:
<P>
<IMG SRC=http://www.itfat.com/picnet/200411/0511722483642395.gif" WIDTH="412" HEIGHT="204" ALT="JSP Page-Centric">
</FONT>
</TD></TR>

<!-- Question 9 -->

<TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">9.
</FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<B>A</B> is correct!<BR></FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<FONT COLOR=red><jsp:getProperty name="worker" property="nine" /> is
incorrect</FONT></FONT></TD>

<% } else { %>
<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Blank <FONT COLOR=red>X</FONT></FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
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.
</FONT>
</TD></TR>

<!-- Question 10 -->

<TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">10.
</FONT></TD>

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

<TD VALIGN="TOP"> <B>D</B> is correct!<BR></FONT></TD>

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

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<FONT COLOR=red><jsp:getProperty name="worker" property="ten" /> is
incorrect</FONT></FONT></TD>

<% } else { %>
<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Blank <FONT COLOR=red>X</FONT></FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Error pages are invoked when there is an uncaught exception from
within a particular page. In this case, we mention that the
<CODE>validationGaurd()</CODE> method might throw an exception.
If this exception is not caught within the page, then we vector
control to the <CODE>errorPage</CODE>, as stipulated in the attribute
of the given page directive.

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

<TR><TD colspan="3"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<P>You missed<STRONG> <%= missed %></STRONG>
<BR>Your score is<STRONG> <%= (int)grade %> </STRONG> percent.
<H4>Source Code</H4>
<P>This quiz used the <I>Page-View with Bean Approach</I>, detailed in <A
HREF="/developer/Books/javaserverpages/">Chapter 12, JSP Archeticure</A>. The <A HREF="index.txt">first
page</A> of the quiz consists of regular HTML with a form that calls <A
HREF="answer.txt"><CODE>answer.jsp</CODE></A>. <CODE>Answer.jsp</CODE> requests parameters from the bean,
in this case, called <A HREF="QuizResponses.txt">QuizResponses</A>. The <I>page-view with bean</I>
approach for this quiz required extra work to write the bean, and it could have been done using the
<I>page-view approach</I> without a bean, requesting invocation directly from the <CODE>answer.jsp</CODE>
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 <I>page-view with bean</I> approach for
illustration purposes.

<P><A HREF=/developer/Quizzes/jsp/index.html>Back to Quiz</A>
<P><IMG SRC=http://www.itfat.com/picnet/200411/0511722483745011.gif ALIGN=LEFT>

</TABLE>
<P>

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

时间: 2024-10-01 21:37:26

jsp在线考试系统-bean文件的相关文章

jsp在线考试系统-htm文件

js|在线 一个在线考试系统,测试你的jsp知识,代码不是特别多,所以不加注释了(http://jspbbs.yeah.net) index.jsp <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"> <TR> <TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sa

jsp在线考试系统-jsp文件

js|在线 一个在线考试系统,测试你的jsp知识,代码不是特别多,所以不加注释了(http://jspbbs.yeah.net) answer.jsp <%-- Include directive --%> <%@ include file="header.html" %> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"> <TR&g

jsp-基于JSP在线考试的WEB系统

问题描述 基于JSP在线考试的WEB系统 求各位大神给一个在线考试系统,不用太复杂,实现登录,从数据库里获取题目,最后给出分数就行了,全部积分献上 解决方案 我有一个,怎么给你??? 解决方案二: http://download.csdn.net/detail/ranismywife/501261http://down.chinaz.com/soft/33116.htm 解决方案三: 如果采纳了并且留下邮箱,我可以把第一个下载下来给你,不要分. 解决方案四: 你下载我网盘的吧http://yun

jsp 在线考试 倒计时-基于JSP的在线考试系统倒计时的设计

问题描述 基于JSP的在线考试系统倒计时的设计 使用的是JDK+Tomact+MyEclipse+SQL 2005,求各位高手指教!

基于Web在线考试系统的设计与实现

这是一个课程设计的文档,源码及文档数据库我都修改过了,貌似这里复制过来的时候图片不能贴出,下载地址:http://download.csdn.net/detail/sdksdk0/9361973   数据库原理课程设计说明书              基于Web在线考试系统的设计与实现             目  录   1 课题背景与意义.3 1.1课题开发背景.3 1.2 课题开发意义.3 2 系统需求分析.4 2.1 项目要求.4 2.2 开发方案.5 2.3开发环境.5 3 总体开发.

利用ASP+XML架设在线考试系统

利用ASP + XML 架设在线考试系统 <-------------此程序非本人原创-------->  使用这个在线的考试系统,我们能处理任何类型在线测试. 尽管我们一般是用传统方式实现,读者非常希望将. 如果从总体上考虑. 所有问题都储存在服务器( 它可能在数据库里) 里面的的xml 文件里. 用户准备花费考试,然后用户测试的通体将通过微软的XML HTTP 组件传送到浏览器. 使用同一个XML HTTP 组件,每当用户请求一个问题的时候,那些问题内容被从服务器解释并且显示在页上. 对用

用ASP开发试题库与在线考试系统

  摘 要利用网络和数据库技术,结合目前硬件价格普遍下跌与宽带网大力建设的有利优势,我们基于B/S模式研究开发了试题库与在线考试系统这一ASP应用程序.它运用方便.操作简单,效率很高,现阶段虽只实现了试卷的客观题部分,但已具有试题(卷)录入.修改和查询,手工组卷与自动组卷以及进行在线考试等重要功能,也就是说实现了真正的无纸化考试,满足任何授权的考生随时随地考试并迅速获得成绩,并给出其详细的成绩分析与试卷评估,同时也大大减轻了教师出题.组卷和改卷等繁重的工作量. 引 言 现阶段,学校与社会上的各种

考试系统 百人 延迟-.net开发的在线考试系统,英语考试在线播放英语听力(mp3)网络延迟卡顿,,)

问题描述 .net开发的在线考试系统,英语考试在线播放英语听力(mp3)网络延迟卡顿,,) 网络已经由原来的百兆改为前兆网口,但是对于几百人的考试依然无法应付,超过百人同事登录读取听力系统将会卡死,求详细解决方案,不详细至少对路,好好答,谢谢大家了. 解决方案 可以使用多个服务器,你的主程序随机分配地址到每个服务器. 解决方案二: 在线考试(3)数据库设计之在线考试系统 解决方案三: 首先要确定你的问题主要是带宽的问题,还是服务端并发处理不过来导致的卡死. 以下几点建议参考: 1.建议压缩音频文

vo封装-Java web编程基础 在线考试系统源代码

问题描述 Java web编程基础 在线考试系统源代码 一.功能说明 1.学生 学生使用学号和密码登录系统,实现在线答题,提交试卷后可以直接查看测试成绩. 2.教师 教师使用教师号和密码登录系统,可以实现题目表question的维护工作(增删改查). 二.结构说明 采用JSP+JavaBean模式,利用VO实现对象的封装. 三.界面说明 界面设计合理.友好,可操作性强,充分考虑用户的使用需求. 四.数据库说明 三张表: 1.学生表student:记录学生的学号.姓名.密码.测试成绩 2.教师表t