设为首页
收藏本站
最近更新

文章搜索
本类热门

 

首页 >> 网络编程 >> JSP >> JSP实例 >> 新闻正文 [字体:  ] [打印文档
在线考试系统代码

文章作者:
责任编辑: 录入时间:2004-11-11 12:57:33 来源:
频道声明:本频道的文章除部分特别声明禁止转载的专稿外,可以自由转载.但请务必注明出出处和原始作者 文章版权归本频道与文章作者所有.对于被频道转载文章的个人和网站,我们表示深深的谢意. 

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

<FONT COLOR=red>X</FONT></FONT></TD>



<% } %>



<TD VALIGN="TOP"><FONT FACE="Verdana,

此新闻共有5页 上一页 1 2 3 4 5 下一页

推荐好友 | 频道收藏 | 打印文档 | 报告错误  
相关连接
·在应用中加入全文检索功能——基于Java的全文索引引擎Lucene简介
·JSP中的字符替换函数str_replace()实现
·JSP编程进度条设计实例
·使用JSP开发WebMail系统
·在线考试系统代码
·JSP记事本程序
·用JSP创建WAP应用
·简易成绩查询系统
同一专题
·无相关专题
发表评论 版权声明:除部分特别声明不要转载,或者授权我站独家播发的文章外,大家可以自由转载我站点的原创文章,但原作者和来自我站的链接必须保留(非我站原创的,按照原来自一节,自行链接)。文章版权归我站和作者共有
转载
要求转载之图片、文件,链接请不要盗链到本站,且不准打上各自站点的水印,亦不能抹去我站点水印。
共有评论查看评论
姓名: