当前位置: 首页 > 图文教程 > 网络编程 > JSP > jsp在线考试系统-jsp文件

JSP
客户端界面中可视化的实现树形框架的设计
Win2000下JBoss开发环境配置
调试处理系统核心文件
Matrix java 大讲坛 之 可用性与人机界面
JMX调试----第三方工具使访问更加容易
用BSF如何在Java中嵌入javascript以及如何在javascript中
再次提醒\" 请不要做浮躁的人\"
从Coding Fan到真正的技术专家(cjsdn)
数据库BEAN:RESIN连接池
基于Java的Web服务器工作原理(一)
XDE中模式驱动的设计与开发(三)
页面流(Page flow)表单验证
高级页面流(Page flow):嵌套、异常处理和 Global.app
请不要做浮躁的人(ZT-必读)
解决日期选择问题,一劳永逸(使用Decorator模式实现日期选择组件)(二)
解决日期选择问题,一劳永逸(使用Decorator模式实现日期选择组件)(三)
解决日期选择问题,一劳永逸(使用Decorator模式实现日期选择组件)(四)
解决日期选择问题,一劳永逸(使用Decorator模式实现日期选择组件)(五)
EJB技术之旅(一)
MVC渐行渐进(二)

JSP 中的 jsp在线考试系统-jsp文件


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-02   浏览: 84 ::
收藏到网摘: n/a

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

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" class="jdc.quiz.QuizResponses" scope="request" />

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


<%-- Scoring --%>

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

<!-- Quiz Questions -->

<!-- Question 1 -->

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

<%-- 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 ++; %>

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


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


<TD VALIGN="TOP"><FONT COLOR=red><jsp:getProperty name="worker" property="one" />
is incorrect!</FONT></TD>

<% } else { %>

<TD VALIGN="TOP">Blank <FONT COLOR=red>X</FONT></TD>

<% } %>

<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Every JavaServer Pages<SUP><FONT SIZE="-2">TM</FONT></SUP>
(JSP)<SUP><FONT SIZE="-2">TM</FONT></SUP>source page is compiled into
a servlet before it is executed at runtime.</A><BR><BR></FONT></TD></TR>

<!-- Question 2 -->


<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