web.xml

 <?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name></display-name> <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param> <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> <filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OpenSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>

applicationContext.xml

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"> <!-- sessionFactory -->
<bean id="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
</bean> <bean id="userDao" class="dao.impl.UserDaoImpl" p:sessionFactory-ref="sessionFactory" /> <bean id="userBiz" class="biz.impl.UserBizImpl" p:userDao-ref="userDao" /> <bean id="userAction" class="action.UserAction" p:userBiz-ref="userBiz" scope="prototype" /> <!-- 事务管理器 -->
<bean id="txManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager" p:sessionFactory-ref="sessionFactory" /> <!-- 事务增强 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice> <!-- 事务切入点 -->
<aop:config>
<aop:pointcut id="bizPointcut" expression="execution(* biz.impl.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="bizPointcut" />
</aop:config>
</beans>

示例下载:SSH简单Demo.zip

最新文章

  1. 常用SQL
  2. Linux基础命令-有关于目录的命令
  3. 浅谈JAVA集合框架
  4. [苏飞开发助手V1.0测试版]官方教程与升级报告
  5. FlyCapture2 Qt5 MinGW Configuration
  6. LDA-math-神奇的Gamma函数
  7. jquery实现的下拉和收缩代码实例
  8. Bootstrap学习之路(3)---列表组件
  9. numpy简单入门
  10. MBTI性格测试
  11. linux 程序运行监控
  12. DotNetOpenAuth实践
  13. php对文件操作(读、写、)的基础知识(详细)
  14. java 虚拟机--新生代与老年代GC [转]
  15. 主席树——求区间第k个不同的数字(向右密集hdu5919)
  16. android 地图
  17. A. Kyoya and Photobooks(Codeforces Round #309 (Div. 2))
  18. 发邮件 文字+ 附件的方法(QQ or 网易 邮箱)
  19. POJ 3414 dfs 回溯
  20. [leetcode]134. Gas Station加油站

热门文章

  1. cryto-js 常用加密库 md5加密
  2. linux运维、架构之路-Kubernetes集群部署TLS双向认证
  3. C#知识点:委托、事件、正则表达式、SVN、找按段等差递增至不变序列的规律
  4. Java——package与import
  5. PS4 Submission
  6. Codeforces Round #369 (Div. 2) A. Bus to Udayland (水题)
  7. [BZOJ3236]:[Ahoi2013]作业(莫队+分块)
  8. 安装fedora23后的一些杂项设置
  9. 如何将阿里云上的RDS 备份的mysql数据还原到windows环境中
  10. Flask框架—flask_sqlalchemy组件使用