文章导航PC6首页软件下载单机游戏安卓资源苹果资源

pc软件新闻网络操作系统办公工具编程服务器软件评测

安卓新闻资讯应用教程刷机教程安卓游戏攻略tv资讯深度阅读综合安卓评测

苹果ios资讯苹果手机越狱备份教程美化教程ios软件教程mac教程

单机游戏角色扮演即时战略动作射击棋牌游戏体育竞技模拟经营其它游戏游戏工具

网游cf活动dnf活动lol周免英雄lol礼包

手游最新动态手游评测手游活动新游预告手游问答

您的位置:首页网页设计JSP实例 → jsp在线考试系统-jsp文件

jsp在线考试系统-jsp文件

时间:2004/11/7 3:38:00来源:本站整理作者:蓝点我要评论(0)

一个在线考试系统,测试你的jsp知识,代码不是特别多,所以不加注释了(http://jspbbs.yeah.net)



answer.jsp



<%-- include="" directive="">

<%@ include="" file="header.html">











<%-- the="" method="" was="" set="" up="" in="" bean="" with="" id="">

<%-- All Java code is enclosed in <%>, leaving HTML to be easily --%>

<%-- changed="" or="" updated.="">



<% score="">









<% else="" if="">









<% else="">







<%>



















<% if="" score="">









<% else="" if="">







<% else="">





<%>

















<% if="" score="">









<% else="" if="">







<% else="">





<%>

















<% if="" score="">









<% else="" if="">







<% else="">







<%>

















<% if="" score="">









<% else="" if="">







<% else="">





<%>

















<% if="" score="">









<% else="" if="">







<% else="">







<%>

















<% if="" score="">









<% else="" if="">







<% else="">





<%>

















<% if="" score="">









<% else="" if="">







<% else="">





<%>

















<% if="" score="">









<% else="" if="">







<% else="">





<%>

















<% if="" score="">









<% else="" if="">







<% else="">





<%>





<%-- scoring="" calculations="">

<%

int missed = 10 - score;

double grade = (double)score/10*100;

%>






Quizzes

Index



JSP Professional, Chapter 12 Quiz

Answers



by Dan Malks






<TABLE BORDER="0" CELLSPACING="8" CELLPADDING="2"















<%-- page="" directive="" that="" applies="" to="" entire="" page.="">

<%@ page="" language="java">



<%-- identifies="" bean="" as="" and="" tells="" the="" page="" where="" to="" locate="" bean.="">





<%-- set="" bean="" properties="" with="" a="" wildcard.="">







<%-- scoring="">



<%-- variable="" declaration="" in="" code="" scriptlet="" --="">

<% int="" score="0;">





















1.

D

is correct!



is incorrect!

Blank X



Every JavaServer PagesTM

(JSP)TMsource page is compiled into

a servlet before it is executed at runtime.



2.

B

is correct!




is

incorrect



Blank

X



When large amounts of Java scriptlet code are mixed with HTML markup

within a JSP page, not only do readability and reuse suffer, but often

bugs are introduced as web-production team members, who may not be

familiar with Java programming, need to modify the accompanying markup.

Additionally, dependencies now exist among various teams competing for the

 file, making the development process less efficient.





3.

D

is correct!




is

incorrect



Blank X



Doing an HTTP redirect requires a round-trip to the client. If this

is not required, and the only desire is to forward the request to

another resource, then this can be much more efficiently accomplished

with the RequestDispatcher. Additionally, when using the

dispatcher the state of the request object is maintained between

resources, which will not be the case with the HTTP redirect.





4.

C

is correct!




is

incorrect



Blank X



Business logic is better contained in a

JavaBeanTM or a servlet, which is

owned by a software developer. When lots of Java code is embedded

directly within the JSP page as scriptlets, the

&quot;cut-and-paste&quot; mentality tends to prevail when it comes

to code reuse.





5.



Ais correct!




is

incorrect



Blank X



Since the servlet is the initial contact point for each request, it is

well-suited to handle logic that is common across multiple requests.

A good example of this type of logic is an authentication check.





6.



Bis correct!




is

incorrect



Blank X



Using a business delegate reduces coupling between the presentation

and business tiers. The presentation tier has no knowledge of the

EJB implementation details, such as Java Naming and Directory

InterfaceTM lookup.





7.



Bis correct!




is

incorrect



Blank X



Using Java scriptlets is the accepted method of doing iteration in

JSPTM 1.0. In

JSPTM 1.1, a custom tag may be used,

which will hide the implementation details of the iteration code.





8.





Ais correct!




is

incorrect

Blank

X



The term Page-Centric is used to describe an architecture where

the initial contact point for the request is a JSP page. An example

is shown visually below:











9.





Ais correct!




is

incorrect



Blank X



When the forward method is used, the invoking resource does not regain

control. Multiple include invocations can be made from the  

resource, while the invoking resource maintains execution control.





10.



Dis correct!




is

incorrect



Blank X



Error pages are invoked when there is an uncaught exception from

within a particular page. In this case, we mention that the

validationGaurd() method might throw an exception.

If this exception is not caught within the page, then we vector

control to the errorPage, as stipulated in the attribute

of the given page directive.










You missed<%= missed="">


Your score is<%= grade="">percent.


Source Code



This quiz used the Page-View with Bean Approach, detailed in <A

HREF="/developer/Books/javaserverpages/">Chapter 12, JSP Archeticure. The first

page of the quiz consists of regular HTML with a form that calls <A

HREF="answer.txt">answer.jsp. Answer.jsp requests parameters from the bean,

in this case, called QuizResponses. The page-view with bean

approach for this quiz required extra work to write the bean, and it could have been done using the

page-view approach without a bean, requesting invocation directly from the answer.jsp

page. Deciding which approach is preferrable depends on the application and how much HTML and Java

scriptlets need to be used. For this quiz we opted for the page-view with bean approach for

illustration purposes.




Back to Quiz


















 





<%@ include="" file="footer.html">

相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 没有查询到任何记录。 学习java必学的几门技术jspSmartUpload上传下载全攻略Tomcat5.x中的虚拟主机配置方法利用iText在JSP中生成PDF报表

人气排行 告诉大家JSP连接数据库程序代码JSP单页面网站文件管理器jsp留言板源代码一: 给jsp初学者.在jsp中用bean和servlet联合实现用户注册、使用JSP + JAVABEAN + XML 开发的一个例子jsp在线考试系统-jsp文件 jsp计数器代码JSP/JAVABEAN+TOMCAT4.0.5+MYSQL组合建站总