【正文】
you need to talk to the from the client to the Web tier to the database(a threetier approach)instead of from an applet directly to a database(a twotier approach)provides increased flexibility and security with little or no performance all, the database call is usually the ratelimiting step, so going through the Web server does not slow things fact, a threetier approach is often faster because the middle tier can perform caching and connection principle, servlets are not restricted to Web or application servers that handle HTTP requests but can be used for other types of servers as example, servlets could be embedded in FTP or mail servers to extend their , a servlet API for SIP(Session Initiation Protocol)servers was recently standardized(see ).In practice, however, this use of servlets has not caught on, and we39。t talk directly to the 重慶三峽學(xué)院畢業(yè)設(shè)計外文翻譯[肖偉]網(wǎng)上購物系統(tǒng)設(shè)計與實現(xiàn)Even if it could, for security reasons, you probably would not want it same argument applies to most other need the Web middle layer to extract the results inside a .Send the explicit data(., the document)to the document can be sent in a variety of formats, including text(HTML or XML), binary(GIF images), or even a pressed format like gzip that is layered on top of some other underlying , HTML is by far the most mon format, so an important servlet/JSP task is to wrap the results inside of .Send the implicit HTTP response 11 shows a single arrow going from the Web middle layer(the servlet or JSP page)to the , there are really two varieties of data sent: the document itself and the behindthescenes HTTP , both varieties are critical to effective HTTP response data involves telling the browser or other client what type of document is being returned(., HTML), setting cookies and caching parameters, and other such Why Build Web Pages Dynamically? many client requests can be satisfied by prebuilt documents, and the server would handle these requests without invoking many cases, however, a static result is not sufficient, and a page needs to be generated for each are a number of reasons why Web pages need to be built onthefly: 1. The Web page is based on data sent by the instance, the results page from search engines and orderconfirmation pages at online stores are specific to particular user don39。s Job Servlets are Java programs that run on Web or application servers, acting as a middle layer between requests ing from Web browsers or other HTTP clients and databases or applications on the HTTP job is to perform the following tasks, as illustrated in Figure 11 1.Read the explicit data sent by the end user normally enters this data in an HTML form on a Web , the data could also e from an applet or a custom HTTP client .Read the implicit HTTP request data sent by the 11 shows a single arrow going from the client to the Web server(the layer where servlets and JSP execute), but there are really two varieties of data: the explicit data that the end user enters in a form and the behindthescenes HTTP varieties are HTTP information includes cookies, information about media types and pression schemes the browser understands, and so .Generate the process may require talking to a database, executing an RMI or EJB call, invoking a Web service, or puting the response real data may be in a relational your database probably doesn39。但我們的立場是:服務(wù)器端Java本非一項新的、為經(jīng)證實的技術(shù)。當然,僅僅是流行并不能證明技術(shù)的優(yōu)越性。存在幾種低廉的插件,通過應(yīng)用這些插件,Microsoft IIS和Zeus 重慶三峽學(xué)院畢業(yè)設(shè)計外文翻譯[肖偉]網(wǎng)上購物系統(tǒng)設(shè)計與實現(xiàn)也同樣支持servlet和jsp技術(shù),它們運行在Windows,Unix/Linus,MacOS,VMS,和IBM大型機操作系統(tǒng)之上。當然,數(shù)組邊界的檢查以及其他內(nèi)存包含特性是java編程語言的核心部分。Servelt不存在這些問題。例如,在C和C++中,可以分配一個100個元素的數(shù)組,然后向第999個“元素“寫入數(shù)據(jù)——實際上是程序內(nèi)存的隨機部分,這完全合法。實現(xiàn)這項預(yù)防措施的難度可能超出我們的想象,在廣泛應(yīng)用的CGI庫中,不斷發(fā)現(xiàn)由這類問題引發(fā)的弱點。安全傳統(tǒng)CGI程序中主要的漏洞來源之一就是,CGI程序常常由通過的操作系統(tǒng)外殼來執(zhí)行。最后,如果他們的項目變得更龐大,他們或許將他從Linux轉(zhuǎn)移到運行IBM WebSphere的IBM大型機上。因此,他們可以切換到BEA WebLogic或Oracle9i AS。同樣,他們的servelt和jsp沒有任何部分需要重寫。如果他們的項目變得更龐大,他們或許希望轉(zhuǎn)移到分布式環(huán)境。項目取得成功之后,他們可以轉(zhuǎn)移到性能更高、管理更容易,但需要付費的服務(wù)器。因此,從美國公司那里購買專用Web服務(wù)器會消耗掉項目的大部分前期資金。首先,這兩個國家都擁有大量訓(xùn)練有素的軟件開發(fā)人員。Marty曾在馬尼拉講授過jsp和servlet培訓(xùn)課程,那兒對servelt和jsp技術(shù)抱很大的興趣。例如,Marty記錄了所有通過電子郵件向他發(fā)送問題的讀者的所在國。這與其他CGI方案形成鮮明的對比,這些CGI方案在初期都需要為購買專利軟件包投入大量的資金。廉價對于開發(fā)用的網(wǎng)站、低容量或中等容量網(wǎng)站的部署,有大量免費或極為廉價的Web服務(wù)器可供選擇。Oracle9i AS 或者StrNine WebStar上運行。為Macromedia JRun編寫的servlet,可以不經(jīng)過任何修改地在Apache Tomcat,Microsoft Internet Information Server,IBM WebSphere。實際上都直接或通過插件支持servlet??梢浦残許ervelt使用Java編程語言,并且遵循標準的API。多個servelt還可以共享數(shù)據(jù),從而易于實現(xiàn)數(shù)據(jù)庫連接共享和類似的資源共享優(yōu)化。Servlet能夠直接于Web服務(wù)器對話,而常規(guī)的CGI程序做不到這一點,至少在不使用服務(wù)器專有API的情況下是這樣。而在CGI中,大部分工作都需要我們資金完成。然而,servelt會一直停留在內(nèi)存中(即使請求處理完畢),因而可以直接存儲客戶請求之間的任意復(fù)雜數(shù)據(jù)。最后,當CGI程序結(jié)束對請求的處理之后,程序結(jié)束。同樣的情況,如果使用servlet則啟動N個線程,單僅僅載入servlet類的單一副本。而使用servelt,Java虛擬機會一直運行,并用輕量級的Java線程處理每個請求,而非重量級的操作系統(tǒng)進程。效率應(yīng)用傳統(tǒng)的CGI,針對每個HTTP請求都用啟動一個新的進程。但在實踐中,servelt的這種用法尚不流行,在此,我們只論述HTTP Servlet。例如,servlet能夠嵌入到FTP或郵件服務(wù)器中,擴展他們的功能。畢竟數(shù)據(jù)庫調(diào)用通常是對速度影響最大的步驟,因而,經(jīng)過中間層可以執(zhí)行高速緩存和連接共享。顯然,這樣很愚蠢;這種情況下,我們需要與數(shù)據(jù)庫進行會話。如果數(shù)據(jù)存儲在數(shù)據(jù)庫中,那么,即使客戶端使用動態(tài)Web內(nèi)容,比如applet,我們依舊需要執(zhí)行服務(wù)器端處理。例如,天氣預(yù)報或新聞網(wǎng)站可能會動態(tài)地構(gòu)建頁面,也有可能會返回之前構(gòu)建的頁面(如果它還是最新的話)。但是,如果頁面周期性地改變,我們可以用兩種方式來處理它:周期性地在服務(wù)器上構(gòu)建新的頁面(和客戶請求無關(guān)),或者僅僅在用戶請求該頁面時再構(gòu)建。頁面由頻繁改變的數(shù)據(jù)導(dǎo)出。兩種輸入都可用來構(gòu)建輸出頁面。在沒有讀取到用戶提交的數(shù)據(jù)之前,我們不知道應(yīng)該顯示什么。實時構(gòu)建頁面的理由有很多種:網(wǎng)頁基于客戶發(fā)送的數(shù)據(jù)。預(yù)先建立的文檔可以滿足客戶的許多請求,服務(wù)器無需調(diào)用servlet就可以處理這些請求。同樣,兩種數(shù)據(jù)對開發(fā)來說都式至關(guān)重要的。但是,到目前為止,HTML式最常用的格式,故而servelt和JSP的重要任務(wù)之一就式將結(jié)果包裝到HTML中。(4)向客戶發(fā)送顯式數(shù)據(jù)(即文檔)。對應(yīng)大多數(shù)其他應(yīng)用重慶三峽學(xué)院畢業(yè)設(shè)計外文翻譯[肖偉]網(wǎng)上購物系統(tǒng)設(shè)計與實現(xiàn)程序,也存在類似的問題。該數(shù)據(jù)庫可能不理解HTTP,或者不能返回HTML形式的結(jié)果,所有Web瀏覽器不能直接與數(shù)據(jù)庫進行會話。這個過程可能需要訪問數(shù)據(jù)庫、執(zhí)行RMI或EJB調(diào)用、調(diào)用Web服務(wù),或者直接計算得出對應(yīng)的響應(yīng)。HTTP信息包括cookie、瀏覽器所能識別的媒體類型和壓縮模式等。,但實際上從客戶端傳送到Web服務(wù)器的數(shù)據(jù)有兩種,它們分別為用戶在表單中輸入的顯式數(shù)據(jù),以及后臺的HTTP信息。然而,數(shù)據(jù)還有可能來自applet或定制的HTTP客戶程序。(1)讀取客戶發(fā)送的顯式數(shù)據(jù)。關(guān)鍵字:JSP技術(shù),Servlet,HTTP服務(wù) Servlets是運行在Web或應(yīng)用服務(wù)器上的Java程序,它是一個中間層,負責連接來自Web瀏覽器或其他HTTP客戶程序的請求和HTTP服務(wù)器上的數(shù)據(jù)庫或應(yīng)用程序。運行環(huán)境硬件與網(wǎng)絡(luò)環(huán)境:用服務(wù)器能運行Windows XP及以上操作系統(tǒng)?!跋到y(tǒng)管理”主要是按指定系檢索該系的學(xué)生信息,維護學(xué)生,系,課程和學(xué)生選課及成績等方面基本信息,包括增加,刪除,修改“系統(tǒng)幫助”主要是幫助學(xué)生能更好及時的完成選課任務(wù)。包括未選課程,已選課程,學(xué)生選課受一些條件的約束,如課程名額限制,該界面允許學(xué)生選課和修改退選?!皩W(xué)生選課”是為學(xué)生提供選課界面。“首頁”主要是介紹衡水學(xué)院的基本情況。正式計算機技術(shù)的迅速發(fā)展使得人們從過去復(fù)雜的手工勞動中得以解脫,從而使這種服務(wù)在現(xiàn)在才可能迅速普及,同時編寫一套完整的學(xué)生信息顯得尤為重要?!敖y(tǒng)一數(shù)據(jù)訪問”提供了高性能的存取包括關(guān)系型和