一个在线考试系统,测试你的jsp知识,代码不是特别多,所以不加注释了(http://jspbbs.yeah.net)
index.jsp
<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</FONT></H2>
<H4 ALIGN="RIGHT"><EM>by Dan Malks</EM></H4>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD>
<IMG SRC="penduke.gif" WIDTH="164" HEIGHT="115" ALIGN=left ALT="Duke">
</TD><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
The <I><A
HREF="/developer/Books/jsp/index.html">JSP Professional: Chapter 12, JSP
Archictecture</A></I> Test your knowledge on the differences between servlets
and JSP, Factor Forward-Factor Back, page-centric verses the dispatcher
approach, and more.
</FONT></TD></TR>
</TABLE>
<HR>
<!-- Form calls the answer.jsp, which invokes the QuizResponses bean -->
<FORM METHOD="POST" ACTION="answer.jsp">
<OL>
<!-- Question 1 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Choose the statement
that best describes the relationship between JavaServer
Pages<SUP><FONT SIZE="-2">TM</FONT></SUP> (JSP<SUP><FONT SIZE="-2">TM</FONT></SUP>)
and servlets: </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="A"> A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Servlets are built on JSP semantics and all servlets are compiled to JSP
pages for runtime usage<BR></FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="B"> B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> JSP and servlets are
unrelated technologies</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="C"> C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Servlets and JSP are
competing technologies for handling web requests. Servlets are being superceded
by JSP, which is preferred. The two technologies are not useful in combination.
</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="D"> D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> JSPs are built on
servlet semantics and all JSPs are compiled to servlets for runtime usage
</FONT></TD></TR>
</TABLE>
<P>
<!-- Question 2 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">What is a benefit of
using JavaBeans<SUP><FONT SIZE="-2">TM</FONT></SUP> to separate business logic
from presentation markup within the JSP environment? </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="A"> A.</FONT></TD>
<TD>
<FONT FACE="Verdana, Arial, Helvetica, sans-serif"> It allows the JSP to
access middleware </FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="B"> B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">It creates a cleaner
role separation between the web-production team and the software development
team, so that the web-production team can focus on presentation markup, while
the software team can focus on building reusable software components for helping
to generate dynamic displays </FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="C"> C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">It provides a dynamic
markup environment, such that JavaBeans are integrated seamlessly with the
template presentation content, in order to create the dynamic display for the
client
</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="D"> D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">It provides the
developer with full access to the Java<SUP><FONT SIZE="-2">TM</FONT></SUP> 2
Platform Enterprise Edition (J2EE<SUP><FONT SIZE="-2">TM</FONT></SUP>),
which is unavailable from outside the JavaBean environment </FONT></TD></TR>
</TABLE>
<P>
<!-- Question 3 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Why use the
<CODE>RequestDispatcher</CODE> to forward a request to another resource,
instead of doing a <CODE>sendRedirect</CODE>? </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="A"> A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Redirects are no
longer supported in the current servlet API</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="B"> B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Redirects are not a
cross-platform portable mechanism</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="C"> C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The <CODE>RequestDispatcher</CODE>
does not use the reflection API</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="D"> D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The
<CODE>RequestDispatcher</CODE> does not require a round trip to the client, and
thus is more efficient and allows the server to maintain request
state</FONT></TD></TR>
</TABLE>
<P>
<!-- Question 4 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">What alternatives exist
to embedding Java code directly within the HTML markup of your JSP page?</FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="A"> A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into
your session manager</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="B"> B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into
sciptlets</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="C"> C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into
JavaBeans and servlets</FONT>
index.jsp
<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</FONT></H2>
<H4 ALIGN="RIGHT"><EM>by Dan Malks</EM></H4>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD>
<IMG SRC="penduke.gif" WIDTH="164" HEIGHT="115" ALIGN=left ALT="Duke">
</TD><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
The <I><A
HREF="/developer/Books/jsp/index.html">JSP Professional: Chapter 12, JSP
Archictecture</A></I> Test your knowledge on the differences between servlets
and JSP, Factor Forward-Factor Back, page-centric verses the dispatcher
approach, and more.
</FONT></TD></TR>
</TABLE>
<HR>
<!-- Form calls the answer.jsp, which invokes the QuizResponses bean -->
<FORM METHOD="POST" ACTION="answer.jsp">
<OL>
<!-- Question 1 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Choose the statement
that best describes the relationship between JavaServer
Pages<SUP><FONT SIZE="-2">TM</FONT></SUP> (JSP<SUP><FONT SIZE="-2">TM</FONT></SUP>)
and servlets: </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="A"> A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Servlets are built on JSP semantics and all servlets are compiled to JSP
pages for runtime usage<BR></FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="B"> B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> JSP and servlets are
unrelated technologies</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="C"> C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Servlets and JSP are
competing technologies for handling web requests. Servlets are being superceded
by JSP, which is preferred. The two technologies are not useful in combination.
</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="D"> D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> JSPs are built on
servlet semantics and all JSPs are compiled to servlets for runtime usage
</FONT></TD></TR>
</TABLE>
<P>
<!-- Question 2 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">What is a benefit of
using JavaBeans<SUP><FONT SIZE="-2">TM</FONT></SUP> to separate business logic
from presentation markup within the JSP environment? </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="A"> A.</FONT></TD>
<TD>
<FONT FACE="Verdana, Arial, Helvetica, sans-serif"> It allows the JSP to
access middleware </FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="B"> B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">It creates a cleaner
role separation between the web-production team and the software development
team, so that the web-production team can focus on presentation markup, while
the software team can focus on building reusable software components for helping
to generate dynamic displays </FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="C"> C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">It provides a dynamic
markup environment, such that JavaBeans are integrated seamlessly with the
template presentation content, in order to create the dynamic display for the
client
</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="D"> D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">It provides the
developer with full access to the Java<SUP><FONT SIZE="-2">TM</FONT></SUP> 2
Platform Enterprise Edition (J2EE<SUP><FONT SIZE="-2">TM</FONT></SUP>),
which is unavailable from outside the JavaBean environment </FONT></TD></TR>
</TABLE>
<P>
<!-- Question 3 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Why use the
<CODE>RequestDispatcher</CODE> to forward a request to another resource,
instead of doing a <CODE>sendRedirect</CODE>? </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="A"> A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Redirects are no
longer supported in the current servlet API</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="B"> B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Redirects are not a
cross-platform portable mechanism</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="C"> C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The <CODE>RequestDispatcher</CODE>
does not use the reflection API</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="D"> D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The
<CODE>RequestDispatcher</CODE> does not require a round trip to the client, and
thus is more efficient and allows the server to maintain request
state</FONT></TD></TR>
</TABLE>
<P>
<!-- Question 4 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">What alternatives exist
to embedding Java code directly within the HTML markup of your JSP page?</FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="A"> A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into
your session manager</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="B"> B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into
sciptlets</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="C"> C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into
JavaBeans and servlets</FONT>