程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> JSP編程 >> 關於JSP >> jsp在線考試系統-bean文件

jsp在線考試系統-bean文件

編輯:關於JSP

一個在線考試系統,測試你的jsp(SUN企業級應用的首選)知識,代碼不是特別多,所以不加注釋了(http://jsp(SUN企業級應用的首選)bbs.yeah.net)
QuizResponses.java

answer.jsp(SUN企業級應用的首選)

<%-- 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(SUN企業級應用的首選) 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(SUN企業級應用的首選):useBean id="worker" class="jdc.quiz.QuizResponses" scope="request" />

<%-- Set bean properties with a wildcard. --%>
<jsp(SUN企業級應用的首選):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(SUN企業級應用的首選):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(SUN企業級應用的首選))<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(SUN企業級應用的首選):getProperty name="worker" property="two" /> is
incorrect</FONT></TD>

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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved