基于课程分类数量划分的自动排课系统外文翻译资料

 2022-11-28 15:47:35

With the popularity of the Inter NET applications, a variety of Web Information System

Has become a pressing issue. Establish the essence of Web information systems

Development of a Web repository (database as the core of a variety of Web letter

Information storage) as the core Web applications. Currently, the Web repositorydevelopment technology

Operation of a wide range of different characteristics. Various periods at all levels, a variety of purposes

Technology co-exist, dizzying mirror chaos, it is difficult to choose. More popular

Java of Ser vet Web repository development program a more practical

Of choice.

Servlet is running the applet on the Web server, can be completed Xu

Multi-client Applet can not complete the work, which runs on the server and clients

No end, do not download do not by the client security restrictions, the running speed

Greatly increased

And Applet running in a browser and extend the browsers ability similar

Like, Serv the let run in the Web server to enable Java Serv the let engine

And expand the capacity of the server. Therefore, we can say Serv the let is run in

Applet on a Web server, Serv the let Jav a Ser vlet API

And Jav a program of classes and packages.

Servlet access model

Serv the let, there are three access models:

(1) an access model

1 browser to Web server to issue a retrieval request.

2 the Web server after receipt of the request, the request forwarded to the Servle tengine.

3 Serlet engine to perform the requested the Ser vlet and directly through JDBC

4Servlet throughJDBC toretrieve search results to generate the html page and

Page back to the Web server.

5 the Web server the page is sent back to the browser.

(2)The second access model

1 browser to Web server to issue a retrieval request.

2 the Web server receives the request after the request forwarded to the of Ser v the letengine.

3 Serv let engine to perform the request the the Ser vlet and retrieve sent

Ja, vabean access to the data.

4data access the Ja vabean searchable database through JDBC information

And from the search results stored in itself.

5Servlet remove search results from the data access Javabean generate

Html page and Ht ml of page back to the w eb server.

6 the Web server the page is sent back to the browser.

(3) The third access model

1 A browser issue a retrieval request to the Web server.

2 Web server receives the request after the request forwarded to the of Ser v the let engine.

Of Ser vlet engine to perform the requested Servlet directly through JDBC inspection

3 The cable database and search results are stored in the result is stored the Jav abean into.Javabean,

4. Ser v the let from the results are stored to remove the search results and

JSP files to format the output page.

2 Servlet functionality and life cycle

Servlet functions

(1) Create and return dynamic Web pages based on customer requests.

(2) create can be embedded into existing HTML pages as part of HTML

Page (HT fragment) of the ML.

(3) and other server resources (including databases and applications based on the Jav a

Program) to communicate.

(4) to handle multiple client connections, receiving the input of more than one client, and

The results broadcast to multiple clients. For example, Ser vlet is a multi-participant

Game server.

(5) of MIM E type filter information on the special handling, such as image

Conversion and server-side include (SSI).

(6) custom processing available to all servers in the standard routine.

2.2Servlet lifecycle

Servlet life cycle begins with it into the Web servers memory

And end in the termination or re-loaded Serv the let.

load.

Load the servlet at the following times:

If you have configured automatic load option, and then start the Web server automatically loaded

After the start of the Web server, the client Serv the let issued for the first time, please

Demand.

Reload Serv the let.

Loaded Servlet, Web servers to create a servlet instance, and

Servlets init () method is called. Servlet initialization parameters in the initialization phase,

The number is passed to the Servlet configuration object.

terminate

When the Web server no longer needs the servlet, or reload Servlet

A new instance of the server calls Serv the lets destroy () method, remove it from the

Memory deleted.

3 How to call Servlet

Method of Ser vlet is called Total five kinds: call in the URL in the form

lt;Formgt; Tag call, call, in HT the ML page in the JSP files

Call, call in an ASP file. The following itemized to be introduced.

call the servlet in the URL.

Simply input format in the browser as http: ∥ yo ur webser ver

the same the ser vlet name name / servlet path / servlet the URL to

The site canbe. Ofwhich:your webser ver name is to refer to the Servlet where theWeb server name, the servlet path is the path refers to the Servlet, the servletThe name refers to the Servlet real name or an alias.

call the Servlet lt;FORMgt; tags

Call of Ser the let the the lt;FORMgt; tag allows users to input data on the Web page, andinput data submitted to the vlet of Ser.Serv the let will be submitted to receive data in different ways.For example: lt;FORM METHOD = 'POST / a GET' the ACTION = '/ servletpat h / serv let name'gt; {place the text input area tags, buttons and other logos}

in the HTML page to call the servlet.

Use lt;SERVLETgt; mark lt;FORMgt; tags, no need to create a complete HTML page.Instead,the servlet output isonly part of the HTMLpage (HTML fragment) and dynamicallyembedded into the stati

剩余内容已隐藏,支付完成后下载完整资料


随着Inter net 的普及应用, 各种Web 信息系统的建立已成为一个迫在眉睫的问题。建立Web 信息系统的实质就是开发一个以Web 信息库( 以数据库为核心的多种Web 信息存储) 为核心的Web 应用系统。目前,Web 信息库开发技术的种类繁多, 特点各异。各个时期、各个层面、各种用途的技术并存, 令人眼花镜乱, 难以选择。而目前较为流行的基于Java Ser vet 技术就是Web 信息库开发方案的一种比较实用的的选择。Serv let 是运行在Web 服务器上的Applet, 可以完成许多客户Applet 不能完成的工作, 它运行在服务器上, 与客户端无任何关系, 不用下载不用受到客户端安全限制, 运行速度大大提高。

与Applet 运行在浏览器上并扩展浏览器的能力相类似, Serv let 运行在启用Java Serv let 引擎的Web 服务器上并扩展该服务器的能力。因此, 可以说Serv let 就是运行在Web 服务器上的Applet, Serv let 就是使用Jav a Ser vlet API及相关类和软件包的Jav a 程序。1 Servlet 的访问模型。

Serv let 有三种访问模型:

( 1) 第一种访问模型。

1 浏览器向Web 服务器发出检索请求。

2 Web 服务器收到请求后将请求转交给Ser vlet 引擎。

3 Serv let 引擎执行所请求的Ser vlet 并通过JDBC 直接检索数据库中的信息。

4Ser vlet 通过JDBC 取回检索结果生成html 页面并将页面送回Web 服务器。

5 Web 服务器将页面发送回浏览器。

( 2) 第二种访问模型

1 浏览器向Web 服务器发出检索请求。

2 Web 服务器收到请求后将请求转交给Ser v let 引擎。

3Serv let 引擎执行所请求的Ser vlet 并将检索式发送给数据访问Ja vabean。

4数据访问Ja vabean 通过JDBC 检索数据库中的信息并将从检索结果存储在自身之中。

5 Ser vlet 从数据访问Javabean 中取出检索结果生成Html 页面并将Ht ml 页面返回给w eb 服务器。

6 Web 服务器将页面发送回浏览器。

( 3) 第三种访问模型。

1浏览器向Web 服务器发出检索请求。

2 Web 服务器收到请求后将请求转交给Ser v let 引擎。

3 Ser vlet 引擎执行所请求的Serv let 直接通过JDBC 检索数据库并将检索结果存储在结果存储Jav abean 之中。

4 Ser v let 从结果存储Jav abea n 中取出检索结果并用JSP 文件格式化输出页面。

5 将格式化后的输出页面发送给Web 服务器。

6 Web 服务器将页面发送回浏览器。

2 Servlet 的功能与生命周期

2. 1 Ser vlet 的功能

( 1) 创建并返回一个基于客户请求的动态Web 页面。

( 2) 创建可嵌入到现有HTML 页面中的一部分HTM L

页面( HT ML 片段) 。

( 3) 与其它服务器资源( 包括数据库和基于Jav a 的应用

程序) 进行通信。

( 4) 处理多个客户机的连接, 接收多个客户机的输入, 并

将结果广播到多个客户机上。例如, Ser vlet 可以是多参与者

的游戏服务器。

( 5) 对特殊的处理采用MIM E 类型过滤资料, 例如图像

转换和服务器端包括( SSI ) 。

( 6) 将定制的处理提供给所有服务器的标准例行程序。

例如, Ser vlet 可以修改如何认证用户。

  2. 2 Ser vlet 的生命周期

Serv let 的生命周期始于将它装入Web 服务器的内存

时, 并在终止或重新装入Serv let 时结束。

( 1) 装入。

在下列时刻装入Ser vlet:

1 如果已配置自动装入选项, 则在启动Web 服务器时自动装入。

2 在Web 服务器启动后, 客户机首次向Serv let 发出请求时。

3 重新装入Serv let 时。

装入Serv let 后,Web 服务器创建一个Ser vlet 实例并且调用Serv let 的init( ) 方法。在初始化阶段, Serv let 初始化参数被传递给Serv let 配置对象。

( 2) 终止。

当Web 服务器不再需要Serv let , 或重新装入Ser vlet 的新实例时, 服务器会调用Serv let 的destr oy ( ) 方法, 将其从内存中删除。

3 如何调用Servlet

调用Ser vlet 的方法共有五种: 在URL 中调用、在窗体〈Form〉标记中调用、在HT ML 页面中调用、在JSP 文件中调用、在ASP 文件中调用。下面将逐项加以介绍。

( 1) 在URL 中调用Serv let。

只需在浏览器中输入格式像http: ∥yo ur webser vername / serv let path/ ser vlet name 一样的Serv let URL 地址即可。其中: yo ur webser ver name 是指Serv let 所在的Web 服务器名, serv let pat h 是指Serv let 的路径, ser vlet

name 是指Serv let 的真实名字或别名。( 2) 在〈FORM〉标记中调用Serv let 。

在〈FORM 〉标记中调用Serv let 使用户能在Web 页面上输入资料, 并将输入资料提交给Ser vlet。Serv let 将根据提交的方法不同, 采用不同的方式接收资料。例如:lt; FORM METHOD = “POST / GET ”ACTION = “/

ser vlet pat h/ serv let name”gt;{ 放置文本输入区域标记、按钮和其它标识}〈/

FORM〉( 3) 在HTM L 页面中调用Serv let。使用〈SERVLET〉标记与使用〈FORM〉标记一样, 无需创建一个完整的HTML 页面。作为替代, Ser vlet 的输出仅是HTML 页面的一部分( HTML 片段) , 且被动态嵌入到原来HT ML 页面中的其它静态文本中。所有这些都发生在服务器上, 且发送给用户的仅是结果HT ML 页面。原始HTM L 页面中包含〈S ERVLET 〉和〈/ SERVLET 〉

标记。Serv let 将在这两个标记中被调用, 且Ser vlet 的响应将覆盖这两个标记间的所有东西和标记本身。例如:〈SERVLET NAME= “my serv let ”CODE= “my serv let .class”CODEBASE= “u r l”initpar am= “v alue”〉〈PARAM NAME= “parm1”VALU E= “v alue1”〉〈PARAM NAME= “parm2”VALU E= “v alue2”〉

⋯⋯〈/SERVLET 〉

( 4) 在JSP 文件中调用Serv let 。

在JSP 文件中调用Ser vlet 所采用的格式与HTM L 页1面中调用完全一样。而且原理也完全相同。只不过调和它的是动态的JSP 文件不是静态的HTML 页面而已。( 5) 在ASP 文件中调用Ser vlet。如果您在Micr oso ft I nt ernet Informatio n Ser ver ( Ⅱ S)上有遗留的ASP 文件, 并且无法将ASP 文件移植成JSP 文件时, 您可用ASP 文件来调用Ser vlet。但必须通过一个特殊的Activ eX 控制, ASP 文件只有通过它才能调用Serv let 。  4 Servlet 如何利用连接管理器高效地管理数据库连接

( 1) 连接管理器的功能。

相对于非Web 应用程序, 基于Web 的应用程序对数据库的访问会导致更高的和不可预料的系统开销, 这是由于Web 用户更为频繁的连接和断开。通常连接与断开数据库连接所用的资源将远远超过检索时所用的资源。连接管理器的功能就是尽可能地减少用户对数据库资源的额外占用, 实现数据库访问的最佳效能。

连接管理器通过建立用户Ser vlet 可用的连接缓冲池将连接的系统开销分摊给多个用户请求。换言之, 每个用户请求仅占用连接/ 断开连接所用系统开销成本的一小部分。在使用初始资源建立缓冲池中的连接后, 其余连接/ 断开连接

所用的系统开销就不大了, 因为这只是重复使用已有的连接而已。Serv let 以如下方式使用连接缓冲池: 当一个用户通过Web 向Serv let 请求时, Serv let 从缓冲池使用一个已有的连接, 这意味着用户请求不会引起数据库的连接系统开销。在Serv let 终止之后, 它将连接返回至连接管理器缓冲池供其它Ser vlet 使用。因而用户请求不会引起数据库的断开连接的系统开销。连接管理器还使用户能够控制到数据库产品的并发连接数。当数据库的许可证协议限定用户数量时, 这一特性是非常有用的。可以为数据库创建一个缓冲池, 并将连接管理器缓冲池的“最多连接数”参数设成数据库产品许可证中限定的最大用户数。如果用其它程序而不用连接管理器连接数据库, 则不能保证该方法有效。( 2) 连接管理器的结构。

连接管理器维护一个连接到特定数据库且处于打开状态的连接缓冲池。缓冲池中寻找可使用的连接的serv let 之间的典型交互作用。

第一步: 当第一个Serv let 试图与连接管理器通信时, 由Java 应用服务器装入连接管理器。只要Java 应用服务器在运行, 连接管理器就一直被装入。第二步: Java 应用服务器将用户请求传递给一个Ser vlet。第三步: Ser vlet 用连接管理器使用的方法从缓冲池中请求一个连接。第四步: 缓冲池给Ser vlet 分配一个池中已有的空闲连接。

第五步: Ser vlet 使用连接与数据库直接对话, 这一过程中使用的是特定数据库的标准API 。第六步: 数据库通过与Ser vlet 的连接返回资料。第七步: 当Ser vlet 结束与数据库通信时, Serv let 把连接归还给连接管理器缓冲池, 以供其它Ser vlet 使用。第八步: Ser vlet 通过Jav a 应用服务器向用户发回响应。当Serv let 请求一个连接时, 如果缓冲池中没有空闲的连接, 那么连接管理器直接与数据库通信。连接管理器将:第九步: 向数据库请求一个新的连接。第十步: 将连接添加到缓冲池中。如果缓冲池中的连接数达到了规定的上限, 连接服务器将不会把新的连接加入缓冲池中。( 3) 连接管理器的性能特性。为缓冲池创建一个新的连接是一项系统开销很高的任务, 新的连接将使用数据库上的资源。因此连接管理器尽量用缓冲池中的现有连接来满足Serv let 的请求。同时, 连接管理器必须尽可能地最小化缓冲池中的空闲连接, 因为这是对系统资源的极大浪费。连接管理器与Serv let 一同执行这些最小化和最大化任务。连接管理器维护每个连接的验证时间标记、最近使用时间标记和正在使用标志。当某个Ser vlet 第一次获得连接时,连接的验证时间标记和最近使用时间标记被设置为当前时间, 连接的正在使用标志则被设置为真。连接管理器可以从某个Serv let 中移走一个长时间未使用的连接, 这个时间长度是由连接管理器的“最长周期”参数指定的。连接管理器可以查看正在使用连接的最近使用时间标记。如果最近使用时间和当前时间之间的时间差大于“最长周期”配置参数, 则本连接将被认为是一个残留连接, 这就

表明占有它的Serv let 已终止或者没有响应。残留连接将被归还给缓冲池以供其它Ser vlet 使用, 它的正在使用标志被设置为假, 且验证和最近使用时间标记被设置为当前时间。如果Ser vlet 准备在较长一段时期内使用连接与数据库多次

通信, 您必须将代码加入Serv let 中, 以便在每次使用连接之前, 确认它仍占有这个连接。连接管理器可以从缓冲池中除去空闲的连接, 因为它们会浪费资源。为了确定哪个连接是空闲的, 连接管理器将检查连接标志和时间标记, 这个操作是通过周期性地获取连接缓冲池信息来实现的。连接管理器检查未被任何Ser vlet 使用的连接( 这些连接的正在使用标志为假) 。如果最近使用时间与当前时间的时间差超过了“最长空闲时间”配置参数, 将认为本连接是空闲的。空闲连接将被从缓冲池中除去, 降至“最少连接数”配置参数指定的较低限定值。 

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[29449],资料为PDF文档或Word文档,PDF文档可免费转换为Word

您需要先支付 30元 才能查看全部内容!立即支付

发小红书推广免费获取该资料资格。点击链接进入获取推广文案即可: Ai一键组稿 | 降AI率 | 降重复率 | 论文一键排版