web.xml 配置
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name>StuSystem</display-name> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </context-param> <filter> <description>解决Hibernate延迟加载的配置</description> <filter-name>OpenSessionInView</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>OpenSessionInView</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <description>struts2的配置</description> <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> </web-app>
applicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 数据源配置 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.OracleDriver" /> <property name="url" value="jdbc:oracle:thin:@localhost:1521:oracle11" /> <property name="username" value="standDB" /> <property name="password" value="123456" /> </bean> <!-- 会话工厂 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle10gDialect </prop> <prop key="hibernate.show_sql"> true </prop> </props> </property> <property name="mappingResources"> <list> <value>cn/entity/Standards.hbm.xml</value> </list> </property> </bean> <!-- 配置事务管理器 --> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <!-- 配置事务的传播特性 --> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="submit*" propagation="REQUIRED" /> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="del*" propagation="REQUIRED" /> <tx:method name="remove*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="modify*" propagation="REQUIRED" /> <tx:method name="check*" propagation="REQUIRED" /> <tx:method name="do*" propagation="REQUIRED" /> <tx:method name="deal*" propagation="REQUIRED" /> <tx:method name="get*" propagation="SUPPORTS" read-only="true" /> <tx:method name="find*" propagation="SUPPORTS" read-only="true" /> <tx:method name="search*" propagation="SUPPORTS" read-only="true" /> <tx:method name="query*" propagation="SUPPORTS" read-only="true" /> <tx:method name="*" propagation="SUPPORTS" read-only="true" /> </tx:attributes> </tx:advice> <!-- 那些类的哪些方法参与事务 --> <aop:config> <aop:pointcut id="serviceMethod" expression="execution(* cn.biz.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"/> </aop:config> <!-- 配置DAO --> <bean id="standardsDao" class="cn.dao.impl.StandardsDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 配置服务层 --> <bean id="standardsBiz" class="cn.biz.impl.StandardsBizImpl"> <property name="standardsDao" ref="standardsDao"></property> </bean> <!-- 配置控制层 --> <bean id="standardsAction" class="cn.action.StandardsAction" scope="prototype"> <property name="standardsBiz" ref="standardsBiz"></property> </bean> </beans>
相关推荐
struts.xml和applicationContext.xml、web.xml的配置
全部都经过了测试,共94个jar包(所有包全部兼容) 包括:SSH全套jar包c3p0+ojdbc14.jar+.hbm.xml(模板)+applicationContext.xml+struts.xml+web.xml======
使用myeclipse8.5搭建SSH后,将struts.xml和applicationContext.xml移动到别的地方,示例中为webroot下的config文件夹中,web.xml中需要做的修改示例。其中对于返回上一层方式不同的myeclipse可能不同,如有的用../...
Struts2.3.16.1+Hibernate3.6.10+Spring3.2.8整合 能够运行,没有任何问题 另外附带applicationContext.xml、struts.xml、hibernate.cfg.xml
SSH框架applicationContext.xml头部文件
ssh分页注释加说明借鉴整理的 ssh分页(.dao,.daoImp,.service,.serviceImp,.action,.jsp,applicationContext.xml
在SSH的applicationContext.xml 中如何配制配制事务
SSH框架所需的XML文件,struts.xml+applicationContext.xml+hibernate.cfg.xml
ssh框架事务管理applicationContext.xml配置文件
struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:applicationContext.xml ...
applicationContext.xml的ssh实用配置
Struts+srping+Hibernate开发青协志愿服务管理系统 数据库 mysql(关系型数据库) 前台技术 JSP(css,js,ajax,el,java) ...applicationContext.xml 中心配置文件 web.xml 项目配置文件 项目一些基本配置参数
Struts+srping+Hibernate开发青协志愿服务管理系统 数据库 mysql(关系型数据库) 前台技术 JSP(css,js,ajax,el,java) ...applicationContext.xml 中心配置文件 web.xml 项目配置文件 项目一些基本配置参数 127.0
applicationContext.xml 中心装备文件 web.xml 项目装备文件 项目一些基本装备参数 127.0.0.1:8080/zyfw/index.action 普通用户zyz1 123456 http://127.0.0.1:8080/zyfw/admin/login.jsp 管理员 a a 登陆 userLogin ...
1、Web.xml 3 2、applicationContext.xml 总代码 4 不必着急 5 <!—4、依赖注入 --> 8 applicationContext.xml中Setter方法类之间的注入 8 applicationContext.xml 中Setter方法属性注入 User配置 8 ...
基于ssh整合jar包与applicationContext.xml配置文件。jar可直接导入即可用。
SSH开发所需的包和配置文件,觉得可用,不要用myeclipse自动生成struts、hibernate、spring能力,自己添加,这个文件包括所需的包和web.xml,struts.xml,applicationContext.xml
参考web.xml,struts-config.xml,applicationContext.xml中对应配置,即可明白所谓ioc