【正文】
r)結(jié)構(gòu)即瀏覽器和服務(wù)器結(jié)構(gòu)。以目前的技術(shù)看,局域網(wǎng)建立 B/S 結(jié)構(gòu)的網(wǎng)絡(luò)應(yīng)用,并通過 Inter/Intra 模式下數(shù)據(jù)庫應(yīng)用,相對易于把握、成本也是較低的。 解決方案: ( 1)維護和升級方式簡單。所以客戶機越來越“瘦”,而服務(wù)器越來越“胖”是將來信息化發(fā)展的主流方向。 大家都知道 windows 在桌面電腦上幾乎一統(tǒng)天下,瀏覽器成為了標準配置,但在服務(wù)器操作系統(tǒng)上 windows 并不是處于絕對的統(tǒng)治地位。 ( 3) 應(yīng)用服務(wù)器運行數(shù)據(jù)負荷較重 。 廉價 對于開發(fā)用的網(wǎng)站、低容量或中等容量網(wǎng)站的部署,有大量免費或極為廉價的 Web 服務(wù)器可供選擇。例如, Marty 記錄了所有通過電子郵件向他發(fā)送問題的讀者 的所在國。首先,這兩個國家都擁有大量訓練有素的軟件開發(fā)人員。項目取得成功之后,他們可 以轉(zhuǎn)移到性能更高、管理更容易,但需要付費的服務(wù)器。同樣,他們的 servelt 和 jsp 沒有任何部分需要重寫。最后,如果他們的項目變得更龐大,他們或許將他從 Linux 轉(zhuǎn)移到運行 IBM WebSphere的 IBM 大型機上。實現(xiàn)這項預(yù)防措施的難度可能超出我們的想象,在廣泛應(yīng)用的CGI 庫中,不斷發(fā)現(xiàn)由這類問題引發(fā)的弱點。 Servelt 不存在這些問題。存在幾種低廉的插件,通過應(yīng)用這些插件, Microsoft IIS 和 Zeus 也同樣支持 servlet 和 jsp 技術(shù),它們運行在 Windows, Unix/Linus,MacOS,VMS,和 IBM大型機操作系統(tǒng)之上。但我們的立場是:服務(wù)器端 Java 本非一項新的、為經(jīng)證實的技術(shù) 。 當然,僅僅是流行并不能證明技術(shù)的優(yōu)越性。當然,數(shù)組邊界的檢查以及其他內(nèi)存包含特性是 java 編程語言的核心部分。例如,在 C 和 C++中,可以分配一個 100個元素的數(shù)組,然后向第999 個 “ 元素 “ 寫入數(shù)據(jù) —— 實際上是程序內(nèi)存的隨機部分,這完全合法。 安全 Servlet 和 Jsp 技術(shù)概要 軟件工程 081 婁文 520813130116 16 傳統(tǒng) CGI 程序中主要的漏洞來源之一就是, CGI 程序常常由通過的操作系統(tǒng)外殼來執(zhí)行。因此,他們可以切換到 BEA WebLogic 或 Oracle9i AS。如果他們的項目變得更龐大,他們或許希望轉(zhuǎn)移到分布式環(huán)境。因此,從美國公司那里購買專用 Web服務(wù)器會消耗掉項目的大部分前期資金。Marty 曾在馬尼拉講授過 jsp 和 servlet 培訓課程,那兒對 servelt 和 jsp 技術(shù)抱很大的興趣。這與其他 CGI 方案形成鮮明的對比,這些 CGI方案在初期都需要為購買專利軟件包投入大量的資金。但是,應(yīng)用服務(wù)器運行數(shù)據(jù)負荷較重,一旦發(fā)生服務(wù)器“ 崩潰”等問題,后果不堪設(shè)想。所以服務(wù)器操作系統(tǒng)的選擇是很多的,不管選用那種操作系統(tǒng)都可以讓大部分人使用 windows 作為桌面操作系統(tǒng)電腦不受影響,這就使的最流行免費的 Linux操作系統(tǒng)快速發(fā)展起來, Linux 除了操作系統(tǒng)是免費的以外,連數(shù)據(jù)庫也是免費的,這種選擇非常盛行。因此,維護和升級革命的方式 是 “瘦”客戶機,“胖”服務(wù)器。對一個稍微大一點單位來說,系統(tǒng)管理人員如果需要在幾百甚至上千部電腦之間來回奔跑,效率和工作量是可想而知的,但 B/S 架構(gòu)的軟件只需要管理服務(wù)器 就行了,所有的客戶端只是瀏覽器,根本不需要做任何的維護。目前我院內(nèi) 網(wǎng)( Intra)、外網(wǎng)( Inter)和北京東方清大公司“案件、辦公管理軟件”就是 B/S 結(jié)構(gòu)管理軟件,干警在局域網(wǎng)各工作站通過 WWW 瀏覽器就能實現(xiàn)工作業(yè)務(wù)。在這種結(jié)構(gòu)下,用戶工作界面是通過 WWW 瀏覽器來實現(xiàn),極少部分事務(wù)邏輯在前端( Browser)實現(xiàn),但是主要事務(wù)邏輯在服務(wù)器端( Server)實現(xiàn),形成所謂三層 3tier 結(jié)構(gòu)。 Oracle9i AS 或者 StrNine WebStar 上運行。實際上都直接或通過插件支持 servlet。多個 servelt 還可以共享數(shù)據(jù),從而易于實現(xiàn)數(shù)據(jù)庫連接共享和類似的資源共享優(yōu)化。而在 CGI中,大部分工作都需要我們資金完成。最后,當 CGI 程序結(jié)束對請求的處理之后,程序結(jié)束。而使用servelt, Java 虛擬機會一直運行,并用輕量級的 Java 線程處理每個請求,而非重量級的操作系統(tǒng)進程。而且,用于會話啟動協(xié)議服務(wù)器的 servlet API 最近已經(jīng)被標準化(參見 servelt 的這種用法尚不流行,在此,我們只論述 HTTP Servlet。從客戶端到 Web層再到數(shù)據(jù)庫(三層結(jié)構(gòu)),要比從 applet 直接到數(shù)據(jù)庫(二層結(jié)構(gòu))更靈活,也更安全,而性能上的損失很少甚至沒有。 頁 面中使用了來自公司數(shù)據(jù)庫或其他數(shù)據(jù)庫斷數(shù)據(jù)源的信息。 如果頁面需要根據(jù)每個具體的請求做出相應(yīng)的改變,當然需要在請求發(fā)生時構(gòu)建響應(yīng)。要記住,用戶提交兩種類型的數(shù)據(jù):顯示(即 HTML 表單的數(shù)據(jù))和隱式(即HTTP 請求的報頭)。然而,許多情況下靜態(tài)的結(jié)果不能滿足要求,我們需要針對每個請求生成一個頁面。但是,實際發(fā)送的數(shù)據(jù)有兩種:文檔本身,以及后臺的 HTTP 信息。 這個文檔可以用各種格式發(fā)送,包括文本( HTML 或 XML),二進制( GIF 圖),甚至可以式建立在其他底層格式之上的壓縮格式,如 gzip。即使它能夠做到這一點,為了安全上的考慮,我們也不希望讓它這么做。 ( 3) 生成結(jié)果。 ( 2) 讀取由瀏覽器發(fā)送的隱式請求數(shù)據(jù)。 Servlet 的工作 是執(zhí)行西門的任務(wù),如圖 所示 。 If need differently only, server connection specially , realize longrange maintenance and upgrading and share. So client puter more and more thin , and server more and more fat is the direction of main stream of future informative development. In the future, software upgrading and maintenance will be more and more easy , and use can more and more simple, this is for user manpower , material resources, time and cost save is obvious , it is astonishing. Therefore defend and escalate revolutionary way is the client puter it is thin , is fat server. ( 2 ) Cost reduction, it is more to select. All know windows in the puter of top of a table on nearly one Tong world, browser has bee standard disposition, but on server operating system, windows is in absolute dominance position not. Current tendency is the application management software that uses the configuration of B/S all , need to install only in Linux server on , and safety is high. The so server option of operating system is many, no matter choosing those operating system, can let the most of ones use windows in order to the puter of top of a table of operating system does not get influence, this for make most popular free Linux operating system develop fast, Linux except operating system is free besides, it is also free to link database, this kind of option is very pupular. Say, many persons on daily, Sina website s , so long as having installed browser for can , and what need not know the server of Sina website to use is that what operating system, and in fact the most of websites do not use windows operating system really, but the puter of user is most of as installing to be windows operating system. ( 3 ) Application server operation data load value paratively. Servlet 和 Jsp 技術(shù)概要 軟件工程 081 婁文 520813130116 7 Since B/S configures management, software installation in server end ( Server ) on, it is been all right that work administrator need to manage server only, the user interface major logic of general affairs in server ( Server ) end pass through WWW browser pletely realization, lose the logic of general affairs very much in front( Browser) realization, all customer ends has only browser, work administrator need to do hardware maintenance only. But application server operation data load is heavier, once occuring server collapse to wait for problem, consequence is unimaginable. Therefore a lot of units have database to stock server , are ready for any eventuality. 5. Inexpensive A number of free or very inexpensive Web servers are good for development use or deployment of low or mediumvolume Web sites. Thus, with servlets and JSP you can start with a free or inexpensive server and migrate to more expensive servers with highperformance capabilities or advanced administration utilities only after your project meets initial success. Th