欢迎光临
我们一直在努力

jsp在线考试系统-htm文件-JSP教程,Jsp/Servlet

建站超值云服务器,限时71元/月

一个在线考试系统,测试你的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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;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"> &nbsp;c.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> moving the code into

javabeans and servlets</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="four"

type="radio" value="d"> &nbsp;d.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> moving the code into a

transaction manager</font></td></tr>

</table>

<p>

<!– question 5 –>

<li><font face="verdana, arial, helvetica, sans-serif"> what type of scriptlet

code is better-suited to being <i>factored forward</i> into a servlet?

</font>

<br>

<table border="0" cellpadding="5" cellspacing="0">

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="five"

type="radio" value="a"> &nbsp;a.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif">code that deals

with logic that is common across requests</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="five"

type="radio" value="b"> &nbsp;b.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif">code that deals

with logic that is vendor specific</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="five"

type="radio" value="c"> &nbsp;c.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif">code that deals

with logic that relates to database access</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="five"

type="radio" value="d"> &nbsp;d.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif">code that deals

with logic that relates to client scope</font></td></tr>

</table>

<p>

<!– question 6 –>

<li><font face="verdana, arial, helvetica, sans-serif">choose the statement that

best describes how to connect jsp pages and ejbs</font>

<br>

<table border="0" cellpadding="5" cellspacing="0">

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="six"

type="radio" value="a"> &nbsp;a.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif">lookup the ejbs from

within a jsp, but use the ejbs from within a basic javabean</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="six"

type="radio" value="b"> &nbsp;b.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif">lookup and use the ejbs

from a separate business delegate. the javabeans that work with jsp pages are

clients to these business delegates and know nothing about ejb

specifics</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="six"

type="radio" value="c"> &nbsp;c.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> lookup and use the

ejbs from within a jsp page, but only as remote references</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="six"

type="radio" value="d"> &nbsp;d.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif">lookup the ejbs from

within a servlet, delegating usage to specific jsp pages</font></td></tr>

</table>

<p>

<!– question 7 –>

<li><font face="verdana, arial, helvetica, sans-serif"> are custom tags

available in jsp 1.0? if not, how else might you implement iteration from

within a jsp? </font>

<br>

<table border="0" cellpadding="5" cellspacing="0">

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="seven"

type="radio" value="a"> &nbsp;a.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> yes, but the only tags

available relate to database access</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="seven"

type="radio" value="b"> &nbsp;b.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> no. to iterate over a

collection of values, one must use scriptlet code</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="seven"

type="radio" value="c"> &nbsp;c.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> no, but there is a

standard &lt;iterate&gt; tag that may be used</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="seven"

type="radio" value="d"> &nbsp;d.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> yes, but custom tags

will not help developers create tags for use in iterating over a

collection</font></td></tr>

</table>

<p>

<!– question 8 –>

<li><font face="verdana, arial, helvetica, sans-serif"> what is the initial

contact point for handling a web request in a <i>page-centric</i> architecture?

</font>

<br>

<table border="0" cellpadding="5" cellspacing="0">

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="eight"

type="radio" value= "a"> &nbsp;a.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> a jsp

page</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="eight"

type="radio" value= "b"> &nbsp;b.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> a

javabean</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="eight"

type="radio" value= "c"> &nbsp;c.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> a

servlet</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="eight"

type="radio" value= "d"> &nbsp;d.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> a session

manager</font></td></tr>

</table>

<p>

<!– question 9 –>

<li><font face="verdana, arial, helvetica, sans-serif">what is the difference

between doing an <i>include</i> or a <i>forward</i> with a

<code>requestdispatcher</code>?</font>

<br>

<table border="0" cellpadding="5" cellspacing="0">

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="nine"

type="radio" value="a"> &nbsp;a.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> the forward method

transfers control to the designated resource, while the include method invokes

the designated resource, substitutes its output dynamically in the display, and

returns control to the calling page.</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="nine"

type="radio" value="b"> &nbsp;b.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> the two methods

provide the same functionality, but with different levels of

persistence</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="nine"

type="radio" value="c"> &nbsp;c.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> the forward method is

deprecated as of jsp 1.1 and the include method should be used in order to

substitue portions of a dynamic display at runtime</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="nine"

type="radio" value="d"> &nbsp;d.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> the include method

transfers control to a dynamic resource, while the forward method allows for

dynamic substitution of another jps pages output, returning control to the

calling resource</font></td></tr>

</table>

<p>

<!– question 10 –>

<li><font face="verdana, arial, helvetica, sans-serif"> what line of code below

might be combined in the same jsp page with a validation guard (for

example,<code> &lt;% bean.validationguard(); %&gt;</code> ), in order to create

an alternate flow of control for scenarios in which exceptions arise. the

<code>validationgaurd</code> method might throw an exception, which should cause

the flow of control to continue in another user-defined page (assume jsp

1.0)</font>

<br>

<table border="0" cellpadding="5" cellspacing="0">

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="ten"

type="radio" value="a"> &nbsp;a.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> <code>&lt;jsp:error

page="errorpage.jsp" guard="true" /&gt;</code></font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="ten"

type="radio" value="b"> &nbsp;b.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> <code>&lt;%@ page

language="java" buffer="8k" %&gt;</code>

</font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="ten"

type="radio" value="c"> &nbsp;c.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"> <code>&lt;jsp:usebean

id="bean" class="examples.bean" scope="request" /&gt;</code></font></td></tr>

<tr><td><font face="verdana, arial, helvetica, sans-serif"><input name="ten"

type="radio" value="d"> &nbsp;d.</font></td>

<td><font face="verdana, arial, helvetica, sans-serif"><code> &lt;%@ page

language="java" errorpage="errorpage.jsp" buffer="8k"

%&gt;</code></font></td></tr>

</table>

</ol>

<p>

<div align="center">

<input type="submit" value="submit">

<input type="reset">

</div>

</form>

</font>

</td>

</tr>

</table>

<p>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » jsp在线考试系统-htm文件-JSP教程,Jsp/Servlet
分享到: 更多 (0)

相关推荐

  • 暂无文章