分类: JAVA2011-08-15 16:24 18775人阅读 评论(4) 收藏 举报
hibernatespringencodingcharactermvc
hibernate由spring管理,配置文件如下: applicationContext.xml
[html] view plaincopy
1.
2. 10. http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 11. http://www.springframework.org/schema/tx 12. http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 13. http://www.springframework.org/schema/context 14. http://www.springframework.org/schema/context/spring-context-3.0.xsd\" > 15. 16. 17. 18. 19. 21. 22. 23. 28. 29. 30. 31. 33. lect 34. 39. 40. 41. 44. 45. 47. 48. 中间写入hibernate注解的实体
42.
有了applicationContext再在web.xml在配置一下便可同时使用spring和hibernate了,但是要使用spring mvc ,还得在web里做一点手脚,具体如下:
[html] view plaincopy
1.
2. 5. 7. 10. 11. 14. 15. 16. 17. 18. 21. 27. 28. 29. 32. 37. 41. 42. 43. 44. 47. 48. 49. 52.
如上面配置文件的注释所说,由于配置了spring mvc ,还得有相关的文件,以上面的配置对应的文件名为: springmvc-servlet.xml
[html] view plaincopy
1.
2. w.springframework.org/schema/p\" 4. xmlns:context=\"http://www.springframework.org/schema/context\" 5. xsi:schemaLocation=\"http://www.springframework.org/schema/beans 6. http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 7. http://www.springframework.org/schema/context 8. http://www.springframework.org/schema/context/spring-context-2.5.xsd\"> 9. 10. 11. 12. 14. 15. odHandlerAdapter\"> 17. 18. cksonHttpMessageConverter\"> 22. 24. 33. 34. olver\"> 36. 41. 42. lver\" 44. p:prefix=\"\" p:suffix=\".jsp\" /> 45. 46. 47. 20.
29.
26.
按照本文所提到的配置文件配置的话,三个文件全部都放在web-inf里面,其中springmvc-servlet.xml里面配置的信息转换用到了两个外加的包 jackson-core-asl-1.4.2.jar jackson-mapper-asl-1.4.2.jar
本文章主要是配置文件的编写,所以不涉及JAVA代码
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- 69lv.com 版权所有 湘ICP备2023021910号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务