第一部分: Struts 開發(fā) 6.83MB 22分36秒 http://beansoft.java-cn.org/download/ssh_1_struts.exe 第二部分: Hibernate + Spring 11.5MB 38分59秒 http://beansoft.java-cn.org/download/ssh_2_hibernate_spring.exe 第三部分: 自己實現(xiàn) SpringProxyAction 5.05MB 14分25秒 http://beansoft.java-cn.org/download/ssh_3_struts_proxy_asm.exe 第四部分: ASM 錯誤解決及用 Spring 的代理實現(xiàn)整合 9.95MB 23分49秒 http://beansoft.java-cn.org/download/ssh_4_spring_struts.exe 大綱 PDF 下載: http://beansoft.java-cn.org/download/spring_struts_hibernate.pdf 427KB 代碼下載(不帶類庫): http://beansoft.java-cn.org/download/myssh.rar 45KB
視頻大綱: Java EE 講座MyEclipse 5.5 開發(fā) Spring 整合 Struts, Hibernate 的應(yīng)用 劉長炯 2007.10 本章要點
創(chuàng)建數(shù)據(jù)庫• 創(chuàng)建數(shù)據(jù)庫Ø 用 MyEclipse Derby 或者其它數(shù)據(jù)庫Ø 用 MyEclipse Database Explorer 管理數(shù)據(jù)庫Ø 執(zhí)行 SQL:• CREATE TABLE bbsuser (• id int(11) NOT NULL,• username varchar(200) NOT NULL,• password varchar(20) NOT NULL,• age int,• PRIMARY KEY (id)• )• ENGINE=MyISAM DEFAULT CHARSET=GBK;快速開發(fā) Struts 應(yīng)用添加 Hibernate 功能添加 Spring 功能Spring 整合 HibernateSpring 整合 Hibernate(續(xù))模擬 Action 代理類實現(xiàn) Struts + SpringSpring 整合 Struts• 添加 Spring Plug inØ <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">Ø <set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml" />Ø </plug-in>• 替換 Action 的 TypeØ <action path="/login“ …Ø type="org.springframework.web.struts.DelegatingActionProxy" />• 在 Spring 配置文件中配置 BeanØ 要點: 通過 path 和 bean 的 name 進行匹配, 這兩個值必須一樣Ø <bean name="/login" class="com.test.struts.action.LoginAction"></bean>• 注入 DAO 的代理 bean• 詳細步驟參考文檔Spring 整合 Struts 的兩種方式• struts1加載spring的兩種方式:
|