




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
中英文资料翻译With
thepopularity
of
theInter
NET
applications,
avarietyofWeb
InformationSystem
Hasbecome
a
pressing
issue.
Establish
the
essence
of
Web
informationsystems
Developmentofa
Web
repository
(database
asthecoreof
avarietyof
Web
letter
Informationstorage)
asthecore
Web
applications.
Currently,theWeb
repositorydevelopment
technology
Operation
of
awiderangeof
differentcharacteristics.
Variousperiods
atalllevels,
avarietyofpurposes
Technology
co-exist,
dizzying
mirror
chaos,itisdifficultto
choose.
More
popular
Java
ofSer
vet
Web
repository
development
program
amorepractical
Of
choice.Servlet
is
running
the
applet
ontheWebserver,
canbecompleted
Xu
Multi-client
Applet
cannotcomplete
thework,whichruns
ontheserver
and
clients
No
end,donot
download
donot
by
the
client
securityrestrictions,
the
running
speed
GreatlyincreasedAndApplet
running
in
a
browser
and
extend
the
browser's
ability
similar
Like,
Serv
thelet
run
in
theWeb
server
to
enable
Java
Serv
thelet
engine
Andexpand
the
capacity
of
the
server.
Therefore,wecansay
Serv
thelet
is
run
in
Applet
onaWebserver,
Serv
thelet
JavaServletAPI
And
Jav
a
program
of
classes
andpackages.Servlet
access
modelServ
thelet,therearethree
accessmodels:
(1)
anaccess
model
1
browserto
Webserver
to
issue
a
retrieval
request.
2
theWeb
server
after
receiptoftherequest,
the
request
forwardedtothe
Servletengine.
3Serlet
engine
toperformtherequested
the
Servlet
and
directly
throughJDBC4Servlet
throughJDBC
toretrieve
searchresults
to
generate
the
html
pageand
Page
backto
the
Webserver.
5
theWeb
server
thepage
is
sent
backtothebrowser.(2)Thesecond
access
model
1
browserto
Webserver
to
issue
a
retrieval
request.
2
theWeb
serverreceivestherequest
afterthe
request
forwardedto
the
ofSer
v
theletengine.
3Servlet
engine
toperformthe
request
the
the
Servlet
and
retrieve
sent
Ja,
vabean
access
to
the
data.
4data
access
the
Javabean
searchabledatabase
throughJDBC
information
And
fromthesearchresults
stored
in
itself.
5Servlet
remove
searchresults
from
the
data
access
Javabean
generate
Html
pageand
Ht
mlof
page
backtothe
w
eb
server.
6
theWeb
server
thepage
is
sent
backtothebrowser.(3)
Thethird
accessmodel1A
browser
issue
a
retrieval
request
totheWebserver.
2
Web
serverreceivestherequest
afterthe
request
forwardedto
the
ofSer
v
thelet
engine.
OfSer
vlet
engine
toperformtherequested
Servlet
directly
throughJDBC
inspection
3The
cable
databaseand
searchresults
arestoredinthe
resultisstored
the
Javabean
into.Javabean,
4.
Ser
v
thelet
from
the
resultsarestored
to
remove
the
searchresults
and
JSPfiles
to
format
the
output
page.2
Servlet
functionalityand
lifecycleServlet
functions(1)
Create
andreturn
dynamicWebpages
based
on
customerrequests.
(2)
create
canbeembeddedinto
existing
HTMLpages
aspartof
HTML
Page(HT
fragment)
of
theML.
(3)
and
other
serverresources
(includingdatabases
and
applications
based
on
the
Jav
a
Program)
tocommunicate.
(4)
to
handle
multiple
client
connections,receiving
the
input
of
more
than
one
client,and
Theresults
broadcastto
multipleclients.
For
example,Ser
vlet
isamulti-participant
Gameserver.
(5)
ofMIM
E
type
filter
information
on
the
specialhandling,suchas
image
Conversionand
server-side
include
(SSI).
(6)
custom
processing
available
to
allserversin
thestandard
routine.2.2ServletlifecycleServlet
lifecycle
begins
with
itinto
the
Webserver'smemory
And
end
in
the
terminationor
re-loaded
Serv
thelet.load.Load
the
servlet
atthefollowing
times:Ifyouhaveconfigured
automatic
load
option,and
then
start
the
Webserver
automaticallyloadedAfter
the
start
of
the
Webserver,
the
client
Serv
thelet
issued
for
the
first
time,please
Demand.Reload
Serv
thelet.Loaded
Servlet,Webservers
tocreatea
servletinstance,
and
Servlet's
init()method
is
called.
Servlet
initialization
parameters
in
the
initializationphase,
The
number
ispassed
totheServlet
configurationobject.SERVLET〉callthe
servlet
in
the
JSPfiles.Call
in
the
JSP
file
format
used
by
the
Servlet
and
HTML
page
tocall
exactlythesame.Andthe
principles
areidentical.
Only
reconcile
its
dynamic
JSP
fileisnota
staticHTML
page.inanASPfile
calls
the
servlet.Ifyou
Micr
oso
ft
I
nt
ernet
Informatio
n-Ser
ver
(II
S)
onthe
legacy
oftheASPfile,
and
cannotbe
ASPfiles
transplanted
into
a
JSPfile,
youcanuse
the
ASPfile
to
ofSer
vlet
iscalled.Butitmustbe
through
a
special
ActiveX
control,
anASPfile
isonlythrough
itcan
callthe
servlet.Servlet
Howto
use
ConnectionManager
toefficientlymanage
thedatabaseconnectionthefunctionality
of
the
ConnectionManager.For
non-Webapplications,
Web-based
application
accesstothedatabase
willleadtohigher
and
unpredictable
overhead,whichis
dueto
morefrequent
Webusers
connectanddisconnect.Normallyconnected
to
theresourcesused
and
disconnectfromthedatabasewillfarexceed
the
resources
used
in
the
retrieval.ConnectionManager
functionis
tominimize
the
additional
occupancy
of
the
usersof
the
database
resources
toachieve
thebestperformance
of
databaseaccess.ConnectionManager
sharing
overhead
throughtheestablishmentof
the
connectionpoolwillconnect
users
Servlet
available
tomultipleusers
request.In
other
words,eachuserrequest
onlythe
connect/
disconnect
with
asmallportion
of
the
overhead
costs.Initialresources
toestablish
the
connection
of
the
buffer
pool,
the
rest
of
the
connect/
disconnectoverhead
isnotbig,because
thisisonly
reuse
the
existing
connection.Serv
thelet
inthefollowingmanner
usingthe
connectionpool:
When
a
user
through
Request
Web
Serv
thelet
thelet
Serv
use
anexisting
connection
fromthebufferpool
Next,
thismeansthat
the
userrequests
donotcause
the
connectiontothedatabasesystem
overhead.
In
After
the
termination
of
serv
thelet
it
connect
toreturn
to
the
pool
forits
ConnectionManager
The
Servlet.
Thus,
the
user
request
doesnotcause
thedatabase
isdisconnected
Ofsystemoverhead.
ConnectionManager
alsoallowsusers
to
beabletocontrol
the
concurrency
of
thedatabaseproducts
even
Then
thenumber.
When
the
database
licenseagreement
limit
the
numberofusers,
thisfeature
is
Veryuseful.
Create
abuffer
pool
forthedatabase,and
connectionmanagement
Buffering
pool
"maximum
numberofconnections"
parameter
setto
the
database
productlicense
limit
Given
maximumnumberofusers.
Ifyouuse
otherprograms
without
ConnectionManagerconnections
Database,youcannot
guaranteethatthemethod
is
effective.thestructureof
theConnectionManager.ConnectionManagerconnectionpooltomaintainaconnectiontoaspecificdatabaseisopen.
Step1:WhenthefirstServthelettryingtoConnectionManagercommunicationsisloadedbytheJavaApplicationServerConnectionManager.
AslongastheJavaapplicationserverrunningtheConnectionManagerhasbeenloaded.Step2:TheJavaapplicationserverpassestherequesttoaservlet.
Step3:ServletConnectionManagerrequestsaconnectionfromthepool.
Stepfour:thebufferpooltoServletallocatedapoolofexistingidleconnection.
Step5:servlettousetoconnectadirectdialoguewiththedatabase,thisprocessisthestandardAPIforaparticulardatabase.
Step6:thedatabasethroughServlettheconnectionreturnsdata.
Step7:WhentheServletendtocommunicatewiththedatabase,servletconnectionsreturnedtotheconnectionmanagerpoolforotherservletuses.Step8:ServletJavaapplicationservertotheusersendsbackresponse.Servletrequestsaconnection,ifthebufferpool,thereisnoidleconnection,thentheconnectionmanagerdirectlycommunicatewiththedatabase.
ConnectionManagerwill:Step9:tothedatabaserequestsanewconnection.
Step10:Addconnectionstothebufferpool.
Ifthebufferpoolisconnectedtotheprescribedceiling,connecttotheserver
Willnotbeanewconnectiontojointhebufferpool
(3)theperformancecharacteristicsoftheConnectionManager.
Bufferpooltocreateanewconnectionisahighoverheadtasks,newconnectionswillusetheresourcesonthedatabase.
Therefore,theConnectionManagerthebestuseofexistingconnectionsofthebufferpooltomeettherequestoftheServlet.
Meanwhile,theconnectingtube
Theprocessormustbeasmuchaspossibletominimizethebufferpoolidleconnections,becausethisisagreatwasteofsystemresources.
ConnectionManagerServtheletwiththeimplementationoftheseminimizeandmaximizetask.
ConnectionManagertomaintaineachconnectionverificationtimestamp,andrecentlyusedtagsandusethelogo.
WhentheaServletfirsttheconnection,connectionverificationtimestamp,andmostrecenttimestampissettothecurrenttime,theconnectionisbeingusedflagissettotrue.ConnectionManagercanberemovedfromaServtheletalong-unusedconnections,thislengthoftimespecifiedbytheConnectionManager,thelongestcycleparameters.ConnectionManagercanviewrecentlyusedmarkisbeingusedtoconnect.
Ifthetimebetweenthemostrecentlyusedtimeandtimedifferenceisgreaterthanthelongestcycleconfigurationparameters,theconnectionwillbeconsideredtobearesidualconnection,whichindicatesServthelettakeitsdiscontinuedornoresponse.
ResidualconnectionwillbereturnedtothepoolforotherServlet,itisbeingusedflagissettofalse,authenticationandtimestampissettothecurrenttime.
IfServletisreadywithinalongerperiodoftimetousetheconnectionwiththedatabaseseveraltimes
Communications,youmustcodetotheServthelet,sothateachtimeyouusetoconnect
Confirmthatitstilloccupiesthisconnection.
ConnectionManagercanberemovedfromthebufferpoolidleconnections,becausethey
Wouldbeawasteofresources.
Inordertodeterminewhichconnectionisidle,ConnectionManagerwillcheck
Investigationconnectedthesignandtimestamp,thisoperationisconnectedbyperiodicaccessto
Bufferpoolinformation.
ConnectionManagercheckshavenotbeenanyServletmake
Withtheconnections(theseconnectionsistousethelogoisfalse).
Ifyouhaverecentlyused
Betweentimeandthecurrenttimedifferenceexceedsamaximumidletimeconfigurationparameters,the
Thattheconnectionisidle.
Idleconnectionwillberemovedfromthebufferpool,downto
Minimumnumberofconnectionsconfigurationparameterspecifiesthelowerlimitvalue.翻译:随着Internet的普及应用,各种Web信息系统的建立已成为一个迫在眉睫的问题。建立Web信息系统的实质就是开发一个以Web信息库(以数据库为核心的多种Web信息存储)为核心的Web应用系统。目前,Web信息库开发技术的种类繁多,特点各异。各个时期、各个层面、各种用途的技术并存,令人眼花镜乱,难以选择。而目前较为流行的基于JavaServet技术就是Web信息库开发方案的一种比较实用的的选择。Servlet是运行在Web服务器上的Applet,可以完成许多客户Applet不能完成的工作,它运行在服务器上,与客户端无任何关系,不用下载不用受到客户端安全限制,运行速度大大提高。与Applet运行在浏览器上并扩展浏览器的能力相类似,Servlet运行在启用JavaServlet引擎的Web服务器上并扩展该服务器的能力。因此,可以说Servlet就是运行在Web服务器上的Applet,Servlet就是使用JavaServletAPI及相关类和软件包的Java程序。1Servlet的访问模型Servlet有三种访问模型:(1)第一种访问模型。1浏览器向Web服务器发出检索请求。2Web服务器收到请求后将请求转交给Servlet引擎。3Servlet引擎执行所请求的Servlet并通过JDBC直接检索数据库中的信息。4Servlet通过JDBC取回检索结果生成html页面并将页面送回Web服务器。5Web服务器将页面发送回浏览器。(2)第二种访问模型1浏览器向Web服务器发出检索请求。2Web服务器收到请求后将请求转交给Servlet引擎。3Servlet引擎执行所请求的Servlet并将检索式发送给数据访问Javabean。4数据访问Javabean通过JDBC检索数据库中的信息并将从检索结果存储在自身之中。5Servlet从数据访问Javabean中取出检索结果生成Html页面并将Html页面返回给web服务器。6Web服务器将页面发送回浏览器。(3)第三种访问模型(见图3)。1浏览器向Web服务器发出检索请求。2Web服务器收到请求后将请求转交给Servlet引擎。3Servlet引擎执行所请求的Servlet直接通过JDBC检索数据库并将检索结果存储在结果存储Javabean之中。4Servlet从结果存储Javabean中取出检索结果并用JSP文件格式化输出页面。5将格式化后的输出页面发送给Web服务器。6Web服务器将页面发送回浏览器。2Servlet的功能与生命周期2.1Servlet的功能(1)创建并返回一个基于客户请求的动态Web页面。(2)创建可嵌入到现有HTML页面中的一部分HTML页面(HTML片段)。(3)与其它服务器资源(包括数据库和基于Java的应用程序)进行通信。(4)处理多个客户机的连接,接收多个客户机的输入,并将结果广播到多个客户机上。例如,Servlet可以是多参与者的游戏服务器。(5)对特殊的处理采用MIME类型过滤资料,例如图像转换和服务器端包括(SSI)。(6)将定制的处理提供给所有服务器的标准例行程序。例如,Servlet可以修改如何认证用户。2.2Servlet的生命周期Servlet的生命周期始于将它装入Web服务器的内存时,并在终止或重新装入Servlet时结束。(1)装入。在下列时刻装入Servlet:1如果已配置自动装入选项,则在启动Web服务器时自动装入。2在Web服务器启动后,客户机首次向Servlet发出请求时。3重新装入Servlet时。装入Servlet后,Web服务器创建一个Servlet实例并且调用Servlet的init()方法。在初始化阶段,Servlet初始化参数被传递给Servlet配置对象。(2)终止。当Web服务器不再需要Servlet,或重新装入Servlet的新实例时,服务器会调用Servlet的destroy()方法,将其从内存中删除。3如何调用Servlet调用Servlet的方法共有五种:在URL中调用、在窗体〈Form〉标记中调用、在HTML页面中调用、在JSP文件中调用、在ASP文件中调用。下面将逐项加以介绍。(1)在URL中调用Servlet。只需在浏览器中输入格式像http:∥yourwebservername/servletpath/servletname一样的ServletURL地址即可。其中:yourwebservername是指Servlet所在的Web服务器名,servletpath是指Servlet的路径,servletname是指Servlet的真实名字或别名。(2)在〈FORM〉标记中调用Servlet。在〈FORM〉标记中调用Servlet使用户能在Web页面上输入资料,并将输入资料提交给Servlet。Servlet将根据提交的方法不同,采用不同的方式接收资料。例如:<FORMMETHOD=“POST/GET”ACTION=“/servletpath/servletname”>{放置文本输入区域标记、按钮和其它标识}〈/FORM〉(3)在HTML页面中调用Servlet。使用〈SERVLET〉标记与使用〈FORM〉标记一样,无需创建一个完整的HTML页面。作为替代,Servlet的输出仅是HTML页面的一部分(HTML片段),且被动态嵌入到原来HTML页面中的其它静态文本中。所有这些都发生在服务器上,且发送给用户的仅是结果HTML页面。原始HTML页面中包含〈SERVLET〉和〈/SERVLET〉标记。Servlet将在这两个标记中被调用,且Servlet的响应将覆盖这两个标记间的所有东西和标记本身。例如:〈SERVLETNAME=“myservlet”CODE=“myservlet.class”CODEBASE=“url”initparam=“value”〉〈PARAMNAME=“parm1”VALUE=“value1”〉〈PARAMNAME=“parm2”VALUE=“value2”〉⋯⋯〈/SERVLET〉(4)在JSP文件中调用Servlet。在JSP文件中调用Servlet所采用的格式与HTML页1面中调用完全一样。而且原理也完全相同。只不过调和它的是动态的JSP文件不是静态的HTML页面而已。(5)在ASP文件中调用Servlet。如果您在MicrosoftInternetInformationServer(ⅡS)上有遗留的ASP文件,并且无法将ASP文件移植成JSP文件时,您可用ASP文件来调用Servlet。但必须通过一个特殊的ActiveX控制,ASP文件只有通过它才能调用Servlet。4Servlet如何利用连接管理器高效地管理数据库连接(1)连接管理器的功能。相对于非Web应用程序,基于Web的应用程序对数据库的访问会导致更高的和不可预料的系统开销,这是由于Web用户更为频繁的连接和断开。通常连接与断开数据库连接所用的资源将远远超过检索时所用的资源。连接管理器的功能就是尽可能地减少用户对数据库资源的额外占用,实现数据库访问的最佳效能。连接管理器通过建立用户Servlet可用的连接缓冲池将连接的系统开销分摊给多个用户请求。换言之,每个用户请求仅占用连接/断开连接所用系统开销成本的一小部分。在使用初始资源建立缓冲池中的连接后,其余连接/断开连接所用的系统开销就不大了,因为这只是重复使用已有的连接而已。Servlet以如下方式使用连接缓冲池:当一个用户通过Web向Servlet请求时,Servlet从缓冲池使用一个已有的连接,这意味着用户请求不会引起数据库的连接系统开销。在Serv
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年度限价商品房预定协议
- 二零二五年度人事外包与员工职业规划实施合同
- 2025年度离婚后子女抚养权变更及监护权移交协议
- 二零二五年度摩控型摩托手车买卖协议
- 二零二五年度原创小说著作权许可与影视改编协议
- 二零二五年度办公室租赁合同模板:含餐饮及休闲设施
- 二零二五年度医疗健康产业银行担保贷款协议
- 2025年度绿色建筑节能材料联合投标协议书
- 二零二五年度岗位股权激励与员工激励方案协议
- 二零二五年度房屋租赁合同租赁期满续租协议范本
- 美国密码法律制度概览 2023
- 综采电缆修复工艺
- 汽修维修费用统计表报价单
- 用电量与气温变化关系分析
- GB/T 7113.1-2014绝缘软管第1部分:定义和一般要求
- 水工建筑钢结构钢闸门图文讲义
- 幼儿园《幼小衔接》课件
- 《梅花》 完整版课件
- 房地产抖音短视频培训课件
- 苏教版数学二年级下册《数学绘本:公主殿下来的那一天》区级展示课(定稿)
- 中国传媒大学-导演手册-课件
评论
0/150
提交评论