1、SSH整合实例Struts、Spring、Hibernate (SSH) 整合实例关键字: struts、spring、hibernate (ssh) 整合实例 首选创建web.xml 主要是配置Struts的ActionServlet和Spring的字符过滤器 Xml代码 1. 2. web-appxmlns=xmlns:xsi=http:/www.w3.org/2001/XMLSchema-instanceversion=2.4xsi:schemaLocation=3. 4. 5. CharacterEncodingFilter6. org.springframework.web.filt
2、er.CharacterEncodingFilter7. 8. encoding9. UTF-810. 11. 12. forceEncoding13. true14. 15. 16. 17. 18. CharacterEncodingFilter19. /*20. 21. 22. 23. action24. org.apache.struts.action.ActionServlet25. 26. config27. /WEB-INF/struts/struts.xml28. 29. 30. debug31. 332. 33. 34. detail35. 336. 37. 038. 39.
3、40. 41. action42. *.do43. 44. 45. 46. 47. 1048. 49. 50. 51. 52. index.jsp53. index.html54. 55. 56. web-app xmlns= xmlns:xsi=http:/www.w3.org/2001/XMLSchema-instance version=2.4 xsi:schemaLocation= CharacterEncodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEnco
4、ding true CharacterEncodingFilter /* action org.apache.struts.action.ActionServlet config /WEB-INF/struts/struts.xml debug 3 detail 3 0 action *.do 10 index.jsp index.html 然后创建struts.xml(String配置文件) 要注意这里集成了Spring插件,把全部Spring配置文件注入到ContextLoaderPlugIn中 Xml代码 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13
5、. 14. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 配置Spring配置文件 Xml代码 1. 2. 3. 4. 5. 6. 7. 8. classpath:hibernate.properties9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. com/po/login.hbm.xml32. 33. 34. 35. 36. $hibernate.dialect37. $hibernate.showSQL38. 39
6、. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. PROPAGATION_REQUIRED,-Exception57. PROPAGATION_REQUIRED,-Exception58. PROPAGATION_REQUIRED,-Exception59. PROPAGATION_REQUIRED,-Exception60. PROPAGATION_REQUIRED,-Exception61. PROPAGATION_REQUIRED,-Exception62. PROPAGATION_REQUIRED,readOnly63. PROPAGATION_REQUIRED,readOnly64. PROPAGATION_REQUIRED,readOnly65. PROPAGATION_REQUIRED,readOnly66. PROPAGATION_REQUIRED67. 68. 69. 70. classpath:hibernate.properties property name=driverClassName value=$hibernat
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1