Weitere ähnliche Inhalte Ähnlich wie Struts Mitac(1) (20) Struts Mitac(1)4. Must Read when Architecting J2EE Applications P of EAA Core J2EE Patterns 2/e 6. Struts Framework 的定位 Web tier / Persistence /workflow Your Code WebLogic / WebSphere ? jRocket VM / JDK ? Linux / Windows ? Struts is one of your architectural decisions 11. Framework and Design Patterns Struts Framework is built upon several well-known proven patterns 簡介 37. 範例 : 時常需要切換多台資料庫 template method hook method 在 template method 中呼叫 hook method 38. 討論 : 彈性的登入機制 Which is template method ? which is hook method ? 41. Model 1 在 JSP 中決定下一頁是那裏,所以稱為 Page Controller ,通常 Page Controller 會有多個。 (PEAA) ASP.NET 的標準做法 42. Model 1 : Page Controller login.jsp 資料庫 index.htm index.jsp 在 JSP 中決定下一頁是那裏,所以稱為 Page Controller Java Bean Request or Session Scope 43. Model 1 有什麼問題 ? Servlet/ JSP Servlet/ JSP Servlet/ JSP Web Server Servlet/ JSP One controller per page , hard to maintain ! 45. Model 2 - MVC index.jsp BO index.htm ControllerServlet Java Bean read data set data Request or Session Scope Forward/Redirect 49. Struts 的 MVC 模型 index.jsp Action Class Business Logic Request or Session Scope index.htm ActionForm Model View Controller ActionServlet 52. MVC 實作基本觀念 (1) index . do Action String Controller String Controller String 用來指定 Controller 類別來處理 Action String 用來指定要交給那個 Action 類別處理 http://localhost:8080/jpetstore/ index.do 59. ActionForm 的處理 askName.jsp ProcessNameAction ActionServlet /processName.do UserNameForm ActionSerlvet 會依據 config 檔 將使用者填入的資料填入 ActionForm 中 ActionForm 的會以參數的形式傳給 Action 類別, 供開發者在取得 ActionForm 的資料 <<ActionForm>> <<Action>> 74. 使用 Struts 控制項 取代傳統 html 控制項 <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <html:html> <html:form action=“sayHello.do”> <html:text property=“userName” /> <html:submit /> </html:form> </html:html> 要先宣告 前面加上 html 的 prefix 相同 ! 83. (revisited) Struts 的 MVC 模型 index.jsp Action Class Business Logic Request or Session Scope index.htm ActionForm Model View Controller ActionServlet Hinweis der Redaktion Understanding the struts framework Framework 是什麼 ? Struts Framework 的功用 ? 一定要用 Struts 嗎 ? 有沒有其它替代方案 ? Struts 要怎麼用 ?