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