【正文】
隨框架也提供一個豐富的標(biāo)簽庫,以使 Struts 易于和 JSP 一起使用。 Model 2 應(yīng)用的一部分發(fā)生改變并不強求其他部分也跟著發(fā)生改變。 Model 2: Servlet/JSP 規(guī)范的 版描述了在一個應(yīng)用中使用 servlet 和 JSP 的架構(gòu)。如果一個組件在一個 JavaBean 中發(fā)現(xiàn)一個這樣的方法,它就知道這個方法可以用來訪問或者改變 JavaBean 的屬性。返回值肯定是邏輯值,不管是 boolean 還是 Boolean。同樣,訪問器 accessor 也經(jīng)常稱為獲取器 getter。 Accessor 通常以小寫的 get 為前綴,后跟屬性名 。返回值通常是 void,因為 mutator 僅僅改變屬性的值,而不返回它們。關(guān)于更多細(xì)節(jié),請參考 JSP 標(biāo)簽庫技術(shù)頁面。 2.創(chuàng)建一個標(biāo)簽庫描述文件 (TLD)來將你的新建的類,映射到一個標(biāo)簽名稱。 JavaBean通過提供符合一致性設(shè)計模式的公共訪問方法將內(nèi)部字段暴露稱為屬性。你可以在 servlet 做的,也可以在 JSP 中做。在運行時,容器也能檢測 JSP 文件和相應(yīng)的類的最后更新時間。腳本元素是一些標(biāo)記,封裝了可以被 JSP 識別的邏輯。單獨使用 servlet 的做法鼓勵混合標(biāo)記和業(yè)務(wù)邏輯,很難區(qū)分團隊人員的專業(yè)工作。也有一些庫有助于你產(chǎn)生 HTML。為了產(chǎn)生響應(yīng),開發(fā)人員不得不使用大量的 println 語句來生成 HTML。獲得這些資源要耗費數(shù)秒時間,這比大多數(shù)沖浪者愿意等的時間要長些。一旦容器實例化了一個 servlet,它就僅為每個新的請求創(chuàng)建一個新的線程。Servlet 容器連接到 Web 服務(wù)器。但,和常規(guī) web server不同, servlet API 是專門設(shè)計來幫助 Java 開發(fā)人員創(chuàng)建動態(tài)應(yīng)用的。 Java servlet: Sun 公司的 Java Servlet 平臺直接解決了 CGI 程序的兩個主要缺點: 首先, servlet 比常規(guī) CGI 程序提供更好的性能和資源利用。 使用的技術(shù): 使用 Struts 的應(yīng)用開發(fā)使用了大量的其他基礎(chǔ)技術(shù)。開發(fā)傳統(tǒng)桌面應(yīng)用的開發(fā)人員更習(xí)慣于那些可以涵蓋應(yīng)用開發(fā)同一性的工具包和開發(fā)環(huán)境。 mutators are used to change a JavaBean’s state. Mutators are always prefixed with lowercase token set followed by the property name. The first character in the property name must be uppercase. The return value is always void— mutators only change property values。大連交通大學(xué)信息工程學(xué)院 2021 屆本科生畢業(yè)設(shè)計(論文)外文翻譯 1 JSP Application Frameworks What are application frameworks: A framework is a reusable, semiplete application that can be specialized to produce custom applications [Johnson]. Like people, software applications are more alike than they are different. They run on the same puters, expect input from the same devices, output to the same displays, and save data to the same hard disks. Developers working on conventional desktop applications are accustomed to toolkits and development environments that leverage the sameness between applications. Application frameworks build on this mon ground to provide developers with a reusable structure that can serve as the foundation for their own products. A framework provides developers with a set of backbone ponents that have the following characteristics: are known to work well in other applications. 2. They are ready to use with the next project. 3. They can also be used by other teams in the anization. Frameworks are the classic buildversusbuy proposition. If you build it, you will understand it when you are done— but how long will it be before you can roll your own? If you buy it, you will have to climb the learning curve— and how long is that going to take? There is no right answer here, but most observers would agree that frameworks such as Struts provide a significant return on investment pared to starting from scratch, especially for larger projects. Enabling technologies: Applications developed with Struts are based on a number of enabling technologies. These ponents are not specific to Struts and underlie every Java web application. A reason that developers use frameworks like Struts is to hide the nasty details behind acronyms like HTTP, CGI, and JSP. As a Struts developer, you don’t need to be an alphabet soup guru, but a working knowledge of these bas