Jsp online examination system-bean File

Source: Internet
Author: User

An online examination system tests your knowledge of jsp (the preferred choice for SUN Enterprise Applications). The Code is not very large, so no comments are added (http: // jsp (preferred for SUN Enterprise Applications) bbs.yeah.net)
QuizResponses. java

Answer. jsp (preferred for SUN Enterprise applications)

<% -- 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 = "# fffff"> jsp (preferred for SUN Enterprise Applications) Professional, Chapter 12 Quiz
Answers </FONT> </H2>
<H4 ALIGN = "RIGHT"> <EM> by Dan Malks </EM> </H4>
<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 (preferred for SUN Enterprise Applications): useBean id = "worker" class = "jdc. quiz. QuizResponses" scope = "request"/>

<% -- Set bean properties with a wildcard. -- %>
<Jsp (preferred for SUN Enterprise Applications): 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 (preferred for SUN Enterprise Applications): 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 explorerver Pages <SUP> <font size = "-2"> TM </FONT> </SUP>
(Jsp (preferred for SUN Enterprise Applications) <SUP> <font size = "-2"> TM </FONT> </SUP> source page is compiled
A servlet before it is executed at runtime. </A> <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 (preferred for SUN Enterprise Applications): getProperty name = "worker" property = "two"/> is
Incorrect </FONT> </TD>

<%} Else {%>
<Td valign = "TOP"> <font face = "Verdana, Arial, Helvetica, sans-serif">

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.