web.xml<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
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_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:dao.xml</param-value>
</context-param>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
<web-app version="2.5"
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_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:dao.xml</param-value>
</context-param>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
解决方案 »
- 求助!!!ireport能实现重叠分组报表吗?
- 用什么数据库好
- 关于hibernate放到linux 下连接数据库的问题
- jsp,javaBean中日志如何管理?log4j
- spring项目打成可运行的jar后不能运行问题
- J2EE初学者需要理解的问题(经典)
- 关于DBCP连接池的回收问题,为什么只长不减,能不能让他在一段时间内自已回收,自已写代码也行,求助啦!!!!!!!!!!
- 在tomcat服务器下,怎么使用java调用tuxedo服务
- 谁能告诉我用jboss部署一个j2ee应用的全过程倒底是怎么样的???
- 请教一个动态mybatis的思路。
- java 链接Oracle 11G需要注意什么?
- 项目的最后一步走不下去了,急!急!急!
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- 开启自动由spring来管理action对象, struts2和spring自动集成 -->
<constant name="struts.objectFactory" value="spring"></constant>
<package name="wossPackage" extends="struts-default">
<action name="user" class="com.briup.woss.web.action.UserAction" method="login">
<result name="success">/index.jsp</result>
</action>
</package>
</struts>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!-- 配置数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@127.0.0.1:1521:XE</value>
</property>
<property name="username">
<value>wood</value>
</property>
<property name="password">
<value>wood</value>
</property>
</bean>
<!-- 配置sessionFactory工厂让spring管理 -->
<bean name="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mappingResources">
<list>
<value>com/briup/woss/pojo/Admins.hbm.xml</value>
<value>com/briup/woss/pojo/Permission.hbm.xml</value>
<value>com/briup/woss/pojo/Products.hbm.xml</value>
<value>com/briup/woss/pojo/Productstype.hbm.xml</value>
<value>com/briup/woss/pojo/Roles.hbm.xml</value>
<value>com/briup/woss/pojo/Users.hbm.xml</value>
<value>com/briup/woss/pojo/UserServices.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- 事物管理器hibernateTransactionManager -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 配置hibernateTemplate模板 -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 配置dao成对象 -->
<bean id="billingDao" class="com.briup.woss.dao.impl.BillingDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="businessDao" class="com.briup.woss.dao.impl.BusinessDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="managerDao" class="com.briup.woss.dao.impl.ManagerDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="productDao" class="com.briup.woss.dao.impl.ProductDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="systemDao" class="com.briup.woss.dao.impl.SystemDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="userDao" class="com.briup.woss.dao.impl.UserDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<!-- 事物的代理工厂bean -->
<bean id="proxyTxDefintion" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true">
<property name="transactionManager" ref="txManager"></property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED,-Exception</prop>
</props>
</property>
</bean>
<!-- 代理serviceBean -->
<bean id="billingService" parent="proxyTxDefintion">
<property name="target">
<bean class="com.briup.woss.service.impl.BillingServiceImpl">
<property name="billingDao" ref="billingDao"></property>
</bean>
</property>
</bean>
<bean id="businessService" parent="proxyTxDefintion">
<property name="target">
<bean class="com.briup.woss.service.impl.BusinessServiceImpl">
<property name="businessDao" ref="businessDao"></property>
</bean>
</property>
</bean>
<bean id="managerService" parent="proxyTxDefintion">
<property name="target">
<bean class="com.briup.woss.service.impl.ManagerServiceImpl">
<property name="managerDao" ref="managerDao"></property>
</bean>
</property>
</bean>
<bean id="productService" parent="proxyTxDefintion">
<property name="target">
<bean class="com.briup.woss.service.impl.ProductServiceImpl">
<property name="productDao" ref="productDao"></property>
</bean>
</property>
</bean>
<bean id="systemService" parent="proxyTxDefintion">
<property name="target">
<bean class="com.briup.woss.service.impl.SystemServiceImpl">
<property name="systemDao" ref="systemDao"></property>
</bean>
</property>
</bean>
<bean id="service" parent="proxyTxDefintion">
<property name="target">
<bean class="com.briup.woss.service.impl.UserServieImpl">
<property name="userDao" ref="userDao"></property>
</bean>
</property>
</bean>
</beans>
<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:context="http://www.springframework.org/schema/context"
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.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config />
<context:component-scan base-package="com.aug" />
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
<bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!--
<property name="annotatedClasses">
<list>
<value>com.aug.model.User</value>
</list>
</property>
-->
<property name="packagesToScan">
<list>
<value>com.aug.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<!-- <prop key="current_session_context_class">${current_session_context_class}</prop> -->
</props>
</property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<aop:config>
<aop:pointcut id="bussinessService"
expression="execution(public * com.aug.service..*.*(..))" />
<aop:advisor pointcut-ref="bussinessService" advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="list*" read-only="true" />
<tx:method name="find*" read-only="true" />
<tx:method name="delete*" propagation="REQUIRED" rollback-for="com.aug.exception.ServiceException;" />
<tx:method name="create*" propagation="REQUIRED" rollback-for="com.aug.exception.ServiceException;" />
</tx:attributes>
</tx:advice>
</beans>
<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_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>TrainingManagement</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<listener>
<listener-class>com.aug.listener.CustomSpringListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<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>
<filter>
<filter-name>i18nFilter</filter-name>
<filter-class>com.aug.filter.I18nFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>i18nFilter</filter-name>
<url-pattern>/*</url-pattern>
<url-pattern>/WEB-INF/course/*</url-pattern>
</filter-mapping>
</web-app>