jsp在线考试系统-bean文件
程序员文章站
2022-03-10 15:36:55
一个在线考试,测试你的(sun企业级应用的首选)知识,代码不是特别多,所以不加注释了((sun企业级应用的首选)bbs.yeah.net)quizresponses.javaans...
一个在线考试,测试你的(sun企业级应用的首选)知识,代码不是特别多,所以不加注释了((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">
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">
上一篇: jsp计数器-bean文件
下一篇: JSP生成静态的hmtl文件