【正文】
the amount of Java code required in a JSP file via tag libraries. One such library is the Logic Tag, which manages conditional generation of output, but this does not prevent the UI developer from going nuts with Java code. Whatever type of framework you decide to use, you should understand the environment in which you are deploying and maintaining the framework. Of course, this task is easier said than done. ? Limited scope Struts is a Webbased MVC solution that is meant be implemented with HTML, JSP files, and servlets. ? J2EE application support Struts requires a servlet container that supports JSP and Servlet specifications. This alone will not solve all your install issues, unless you are using Tomcat . I have had a great deal of problems installing the library with Netscape iPla , which is supposedly the first J2EEpliant application server. I remend visiting the Struts User Mailing List archive (see Resources) when you run into problems. ? Complexity Separating the problem into parts introduces plexity. There is no question that some education will have to go on to understand Struts. With the constant changes occurring, this can be frustrating at times. Wele to the Web. 第 11頁 共 20頁 ? Where is... I could point out other issues, for instance, where are the client side validations, adaptable workflow, and dynamic strategy pattern for the controller? However, at this point, it is too easy to be a critic, and some of the issues are insignificant, or are reasonable for a release. The way the Struts team goes at it, Struts might have these features by the time you read this article, or soon after. Future of Struts Things change rapidly in this new age of software development. In less than 5 years, I have seen things go from cgi/perl, to ISAPI/NSAPI, to ASP with VB, and now Java and J2EE. Sun is working hard to adapt changes to the JSP/servlet architecture, just as they have in the past with the Java language and API. You can obtain drafts of the new JSP and Servlet specifications from the Sun Web site. Additionally, a standard tag library for JSP files is appearing. 第 12頁 共 20頁 Struts—— 一種開源 MVC 的實(shí)現(xiàn) 《 IBM 系統(tǒng)研究 ,2020,44(2):3337》 作者: Malcolm Davis 這篇文章介紹 Struts,一個(gè)使用 servlet 和 JavaServer Pages 技術(shù)的一種 ModelViewController 的實(shí)現(xiàn)。t able to have direct involvement in page development. ? HTML embedded into code is ugly. ? For the Web, the classical form of MVC needed to change. Figure 4 displays the Web adaptation of MVC, also monly known as MVC Model 2 or MVC 2. ? Struts details 第 3頁 共 20頁 ? Displayed in Figure 6 is a strippeddown UML diagram of the package. Figure 6 shows the minimal relationships among ActionServlet (Controller), ActionForm (Form State), and Action (Model Wrapper). Figure 6. UML diagram of the relationship of the Command (ActionServlet) to the Model (Action amp。網(wǎng)頁設(shè)計(jì)師(或者 HTML開發(fā)人員)必須理解顏色、用戶、生產(chǎn)流程、網(wǎng)頁布局、瀏覽器兼容性、圖像創(chuàng)建、JavaScript 等等。 模型 視圖 控制器 (MVC) JSP 標(biāo)簽只解決了我們問題中的一部分。它是應(yīng)用程序的外表。 在 Web 上,瀏覽器必須重復(fù)詢問服務(wù)器端以此來發(fā)現(xiàn)應(yīng)用程序結(jié)構(gòu)的改變。 對(duì)于 Web, MVC 的經(jīng)典形式將需要改變 。就 Struts 而言,控制器 就 是 一個(gè) 以 servlet 執(zhí)行 的一個(gè)命令設(shè)計(jì)模式。 ? 視圖 視圖就是一個(gè) JSP 文件。函數(shù)指針裝扮了在 C 語言結(jié)構(gòu)化程序設(shè)計(jì)中的舊時(shí)光 。在 Web 工程 創(chuàng)建 期間 , Action 和 ActionForm 被 擴(kuò)展 用 來解決 特殊 的問題 空間 。例如,你可能有一個(gè)由 HTML 表單設(shè)置的 UserActionForm 。別的網(wǎng)頁或業(yè)務(wù) 對(duì)象 可能 有方法 使用 UserActionForm , 然而驗(yàn)證可能不同 。要使用 Action , 需重寫 process() 原理 。 Action 的用途是 “將類的接口轉(zhuǎn)換為客戶機(jī)所需的另一個(gè)接口。真是金無足赤。 配置信息被轉(zhuǎn)換為一組 ActionMapping ,而后者又被放入 ActionMappings 容器中。此外,如果你正在學(xué)習(xí) JSP 標(biāo)記技術(shù),則 Struts 為你提供了一個(gè)起點(diǎn)。他們正在向著發(fā)行版本 而努力,但與任何 版本一樣,它不可能盡善盡美。在 UI 開發(fā)中限制訪問 Java 有一定的合理性。當(dāng)然,這項(xiàng)任務(wù)真是說起來容易做起來難。隨著變化的不斷加入,這有時(shí)會(huì)令人很沮喪。此外,一個(gè)標(biāo)準(zhǔn)的 JSP 標(biāo)記庫 正在出現(xiàn)。 ? 復(fù)雜性 在將問題分為幾個(gè)部分的同時(shí)也引入了復(fù)雜性。 Logic Tag 就是這樣的一種庫,它對(duì)有條件地生成輸出進(jìn)行管理,但這并不能阻止 UI 開發(fā)人員對(duì) Java 代碼的狂熱。 ? 正確的抽象級(jí)別 Struts 是否提供了正確的抽象級(jí)別?對(duì)于網(wǎng)頁設(shè)計(jì)人員而言,什么是正確的抽 第 19頁 共 20頁 象級(jí)別呢?這是一個(gè)用 $64K 的文字才能解釋清楚的問題。問題 越來越復(fù)雜,并且需要越來越多的管理。這個(gè)特性能很好地集成到基于 JSP 的開發(fā)工具 中,這些工具允許用標(biāo)記編寫代碼。控制器查看輸入事件并將請(qǐng)求分派給某個(gè) Action 類。(一個(gè)有趣的發(fā)現(xiàn)是, Action 是類而不是接口)。通過將業(yè)務(wù)邏輯放在單獨(dú)的包或 EJB 中,我們就可以提供更大的靈活性和可重用性。 Action 類 Action 類是 一個(gè)圍繞 業(yè)務(wù)邏輯的一個(gè) 包裝器 。 ? 在傳遞它 到 Action 類之前, Struts 將 還會(huì)對(duì) UserActionForm 調(diào)用 validation() 方法進(jìn)行表單驗(yàn)證。 ActionForm 是一個(gè)必須為每個(gè)輸入表單模型創(chuàng)建該類的子類 的 抽象類。 ActionServlet (Command) 創(chuàng)建并使用 Action 、 ActionForm 和 ActionForward 。 ActionForm) 之間的關(guān)系的 UML 圖 ActionServlet 類 你還記得 使用 函數(shù)映射的日子嗎? 你會(huì)映射一些輸入時(shí)間到一個(gè)函數(shù)的一個(gè)指針 。 ActionForm bean 在會(huì)話級(jí)或請(qǐng)求級(jí)表示模型的狀態(tài),而不是在持久級(jí)。 Web 容器將 會(huì) 用一個(gè) HTTP 響應(yīng) 來 作出響應(yīng)。 ? 頁面設(shè)計(jì)人員將不能直接介入到頁面的開發(fā)中 。 MVC 模型 2 Web 給軟件開發(fā)人員帶來了一些獨(dú)特的挑戰(zhàn) , 最顯著的就是客戶端和服務(wù)器端的無結(jié)構(gòu)連接 。它對(duì)于視圖或者控制器一無所知。 Struts 是一種 MVC 實(shí)現(xiàn),它將 Servlet 和 JSP 標(biāo)記(屬于 J2EE 規(guī)范)用作實(shí)現(xiàn)的一部分。 簡介 在小學(xué)校園里的小孩子們都可以在因特網(wǎng)上發(fā)布 HTML 網(wǎng)頁。 畢業(yè)設(shè)計(jì) 外文文獻(xiàn)原文及譯文 學(xué)生姓名: 學(xué)號(hào): 系 別: