【正文】
lowercase token get, a logical property can use the prefix is, followed by the property name. The first character in the property name must be uppercase. The return value will always 畢業(yè)設(shè)計(論文) 外文 翻譯 —— 原文 9 be a logical value— either boolean or Boolean. Logical accessors cannot accept parameters in their method signature. The boolean accessor method signature for an on property would be public boolean isOn() The canonical method signatures play an important role when working with Java Beans. Other ponents are able to use the Java Reflection API to discover a JavaBean’s properties by looking for methods prefixed by set, is, or get. If a ponent finds such a signature on a JavaBean, it knows that the method can be used to access or change the bean’s properties. Sun introduced JavaBeans to work with GUI ponents, but they are now used with every aspect of Java development, including web applications. When Sun engineers developed the JSP tag extension classes, they designed them to work with JavaBeans. The dynamic data for a page can be passed as a JavaBean, and the JSP tag can then use the bean’s properties to customize the output. For more on JavaBeans, we highly remend The Awesome Power of JavaBeans, by Lawrence H. Rodrigues [Rodrigues]. The definitive source for JavaBean information is the JavaBean Specification [Sun, JBS]. Model 2: The release of the Servlet/JSP Specification described Model 2 as an architecture that uses servlets and JSP pages together in the same application. The term Model 2 disappeared from later releases, but it remains in popular use among Java web developers. Under Model 2, servlets handle the data access and navigational flow, while JSP pages handle the presentation. Model 2 lets Java engineers and HTML developers each work on their own part of the application. A change in one part of a Model 2 application does not mandate a change to another part of the application. HTML developers can often change the look and feel of an application without changing how the backoffice servlets work. The Struts framework is based on the Model 2 architecture. It provides a controller servlet to handle the navigational flow and special classes to help with the data access. A substantial custom tag library is bundled with the framework to make Struts easy to use 畢業(yè)設(shè)計(論文) 外文 翻譯 —— 原文 10 with JSP pages. Summary: In this article, we introduced Struts as an application framework. We examined the technology behind HTTP, the Common Gateway Interface, Java servlets, JSPs, and JavaBeans. We also looked at the Model 2 application architecture to see how it is used to bine servlets and JSPs in the same application. Now that you have had a taste of what it is like to develop a web application with Struts, in chapter 2 we dig deeper into the theory and practice behind the Struts architecture. 大連海事 大學(xué)畢業(yè)設(shè)計(論文)外文翻譯 —— 譯文 11 JSP 應(yīng)用框架 什么是應(yīng)用框架: 框架( framework)是可重用的,半成品的應(yīng)用程序,可以用來產(chǎn)生專門的定制程序。象人一樣,軟件應(yīng)用的相似性比不同點要多。它們運行在相似的機器上,期望從相同的設(shè)備輸入信息,輸出到相同的顯示設(shè)備,并且將數(shù)據(jù)存儲到相同的硬盤設(shè)備。開發(fā)傳統(tǒng)桌面應(yīng)用的開發(fā)人員更習(xí)慣于那些可以涵蓋應(yīng)用開發(fā)同一性的工具包和開發(fā)環(huán)境。構(gòu)架在這些公共基礎(chǔ)上的應(yīng)用框架可以為開發(fā)人員提供可以為他們的產(chǎn)品提供可重用服務(wù)的基礎(chǔ)架構(gòu)。 框架向開發(fā)人員提供一系列具有以下特征的骨架組件: 1.已經(jīng)知道它們在其它程序上工作得 很好; 2.它們隨時可以在下一個項目中使用; 3.它們可以被組織的其它團隊使用; 對于框架是典型的構(gòu)建還是購買命題。如果你自己構(gòu)建它,在你完成時你就會理解它,但是在你被融入之前又將花費多長時間呢?如果要購買,你必須得克服學(xué)習(xí)曲線,同樣,在你可以用它進行工作之前又得花多長時間?這里沒有所謂正確答案,但許多觀察者都會同意,象 Struts 這樣的框架能提供比從頭開始開發(fā)更顯著的投資回報,特別是對于大型項目來說。 其它類型的框架: 框架的概念不僅用于應(yīng)用程序也可用于組件。在其它的資料里面,我們也介紹了一些可以和 Struts 一起使用的框架。這些包括 Lucene 搜索引擎, Scaffold工具包,Struts 驗證器,以及 Tiles 標簽庫。與應(yīng)用框架一樣,這些工具也提供了一些半完成的版本,可以用在用戶的定制組件之中。某些框架被限制于專門的開發(fā)環(huán)境中。 Struts以及本文中涉及的組件卻不是這樣。你可以在很多環(huán)境中來開發(fā) Struts: Visual Age for Java, JBuilder, Eclipse, Emacs, 甚至使用 Textpad。對于你的工具,如果你可以用來開發(fā) Java, 你就可以用它來開發(fā) Struts。 使 用的技術(shù): 使用 Struts 的應(yīng)用開發(fā)使用了大量的其他基礎(chǔ)技術(shù)。這些技術(shù)并不是專門針對大連海事 大學(xué)畢業(yè)設(shè)計(論文)外文翻譯 —— 譯文 12 Struts,而是所有 Java web 應(yīng)用都可以使用的。開發(fā)者使用 Struts 之類的框架是為了隱藏在諸如 HTTP, CGI,以及 JSP之類技術(shù)后面的繁瑣的細節(jié)。作為一個 Struts開發(fā)者,你并不需要知曉所有的相關(guān)知識,但是這些基本技術(shù)的工作原理可能有助于你針對棘手問題設(shè)計出創(chuàng)造性的方案。 超文本傳輸協(xié)議 (HTTP): 當兩個國家之間進行調(diào)解時,外交官們總是遵循一定的正式協(xié)議。外交協(xié)議主要設(shè)計來避免誤解,以及防止談判破裂。 同樣,當計算機間需要對話,它們也遵循一個正式的協(xié)議。這個協(xié)議定義數(shù)據(jù)是如何傳輸,以及它們到達后如何進行解碼。Web應(yīng)用程序就是使用 HTTP協(xié)議在運行瀏覽器的計算機和運行的服務(wù)器的程序間傳輸數(shù)據(jù)。 很多服務(wù)器應(yīng)用程序使用 HTTP之外的其他協(xié)議。他們在計算機之間維護一個持久性的連接。應(yīng)用服務(wù)器可以清楚的知道是誰連接上來,而且何時中斷連接。因為它們知道每一個連接的狀態(tài),以及每一個使用它的人。這稱之為狀態(tài)協(xié)議。 相反, HTTP是一個無狀態(tài)協(xié)議。 HTTP Server 可以接受來自于各種客戶的各種請求,并提供各種響 應(yīng),即使是這個響應(yīng)僅僅是說 No。沒有大量的協(xié)商和連接持久性,無狀態(tài)協(xié)議可以處理大量的請求。這也是 Inter 可以擴展到很多計算機的原因。 HTTP 成為通用標準的原因是其簡單性。 HTTP 請求看起來就像一個平常的文本文檔。這使應(yīng)用程序很容易創(chuàng)建 HTTP請求。你甚至可以通過標準的程序如 Tel來手動傳遞一個 HTTP請求。當 HTTP響應(yīng)返回時,它也是一個開發(fā)者可以直接閱讀的平面文本。 HTTP 請求的第一行包含方法,其后是請求的來源地址和 HTTP 版本。 HTTP 請求頭跟在首行后面,可以沒有也可以有多個。 HTTP 頭向服務(wù)器提供額外的信息??梢园g覽器的種類和版本,可接受的文檔類型,瀏覽器的 cookies等等。 7 種請求方法中, GET和 POST是用得最多的。 一旦服務(wù)器接收到請求,它就要產(chǎn)生一個 HTTP響應(yīng)。響應(yīng)的第一行稱為狀態(tài)行,包含了 HTTP協(xié)議的版本,數(shù)字型狀態(tài),以及狀態(tài)的簡短描述。狀態(tài)行后,服務(wù)器將返回一個 HTTP 響應(yīng)頭,類似于 HTTP 請求頭。如上所述, HTTP 并不在請求間保持狀態(tài)信息。服務(wù)器接受請求,發(fā)出響應(yīng),并且繼續(xù)愉快地處理文本請求。 因為簡單和效率,無狀態(tài)協(xié)議不適合于需要跟蹤用戶狀態(tài)的動態(tài)應(yīng)用 。 Cookies和 URL 重寫是兩個在請求間跟蹤用戶狀態(tài)的方式。 cookie是一種特殊的信息包,大連海事 大學(xué)畢業(yè)設(shè)計(論文)外文翻譯 —— 譯文 13 存儲于用戶的計算機中。 URL重寫是在頁面地址中存儲一個特殊的標記, Java服務(wù)器可以用它來跟蹤用戶。這兩種方法都不是無縫的,是