web.xml
<?
xml version="1.0" encoding="UTF-8"
?>
< web-app xmlns ="http://java.sun.com/xml/ns/j2ee" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" version ="2.4"
xsi:schemaLocation ="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<!-- Spring ApplicationContext配置文件的路径�,可使用通配符,多个路径用�1,号分隔,此参数用于后面的Spring-Context loader -->
< context-param >
< param-name > contextConfigLocation </ param-name >
< param-value > classpath*:spring/*.xml </ param-value >
</ context-param >
<!-- 著名 Character Encoding filter -->
< filter >
< filter-name > encodingFilter </ filter-name >
< filter-class > org.springframework.web.filter.CharacterEncodingFilter </ filter-class >
< init-param >
< param-name > encoding </ param-name >
< param-value > UTF-8 </ param-value >
</ init-param >
</ filter >
<!-- Hibernate Open Session in View Filter -->
< filter >
< filter-name > hibernateFilter </ filter-name >
< filter-class > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter </ filter-class >
</ filter >
<!-- ExtremeTable 导出Excel和Pdf的Filter -->
< filter >
< filter-name > eXtremeExport </ filter-name >
< filter-class > org.extremecomponents.table.filter.ExportFilter </ filter-class >
</ filter >
< filter-mapping >
< filter-name > encodingFilter </ filter-name >
< url-pattern > *.do </ url-pattern >
</ filter-mapping >
< filter-mapping >
< filter-name > encodingFilter </ filter-name >
< url-pattern > *.jsp </ url-pattern >
</ filter-mapping >
< filter-mapping >
< filter-name > hibernateFilter </ filter-name >
< url-pattern > *.do </ url-pattern >
</ filter-mapping >
<!-- Spring ApplicationContext 载入 -->
< listener >
< listener-class > org.springframework.web.context.ContextLoaderListener </ listener-class >
</ listener >
<!-- Spring 刷新Introspector防止内存泄露 -->
< listener >
< listener-class > org.springframework.web.util.IntrospectorCleanupListener </ listener-class >
</ listener >
<!-- session超时定义,单位为分钟 -->
< session-config >
< session-timeout > 10 </ session-timeout >
</ session-config >
</ web-app >
< web-app xmlns ="http://java.sun.com/xml/ns/j2ee" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" version ="2.4"
xsi:schemaLocation ="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<!-- Spring ApplicationContext配置文件的路径�,可使用通配符,多个路径用�1,号分隔,此参数用于后面的Spring-Context loader -->
< context-param >
< param-name > contextConfigLocation </ param-name >
< param-value > classpath*:spring/*.xml </ param-value >
</ context-param >
<!-- 著名 Character Encoding filter -->
< filter >
< filter-name > encodingFilter </ filter-name >
< filter-class > org.springframework.web.filter.CharacterEncodingFilter </ filter-class >
< init-param >
< param-name > encoding </ param-name >
< param-value > UTF-8 </ param-value >
</ init-param >
</ filter >
<!-- Hibernate Open Session in View Filter -->
< filter >
< filter-name > hibernateFilter </ filter-name >
< filter-class > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter </ filter-class >
</ filter >
<!-- ExtremeTable 导出Excel和Pdf的Filter -->
< filter >
< filter-name > eXtremeExport </ filter-name >
< filter-class > org.extremecomponents.table.filter.ExportFilter </ filter-class >
</ filter >
< filter-mapping >
< filter-name > encodingFilter </ filter-name >
< url-pattern > *.do </ url-pattern >
</ filter-mapping >
< filter-mapping >
< filter-name > encodingFilter </ filter-name >
< url-pattern > *.jsp </ url-pattern >
</ filter-mapping >
< filter-mapping >
< filter-name > hibernateFilter </ filter-name >
< url-pattern > *.do </ url-pattern >
</ filter-mapping >
<!-- Spring ApplicationContext 载入 -->
< listener >
< listener-class > org.springframework.web.context.ContextLoaderListener </ listener-class >
</ listener >
<!-- Spring 刷新Introspector防止内存泄露 -->
< listener >
< listener-class > org.springframework.web.util.IntrospectorCleanupListener </ listener-class >
</ listener >
<!-- session超时定义,单位为分钟 -->
< session-config >
< session-timeout > 10 </ session-timeout >
</ session-config >
</ web-app >
<!
DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
< struts >
< include file ="struts-default.xml" />
< package name ="default" extends ="struts-default" >
< action name ="login" method ="login" class ="userAction" >
< result > /login_success.jspresult>
< result name ="input" > /login.jspresult>
< action >
< package >
< struts >
"http://struts.apache.org/dtds/struts-2.0.dtd">
< struts >
< include file ="struts-default.xml" />
< package name ="default" extends ="struts-default" >
< action name ="login" method ="login" class ="userAction" >
< result > /login_success.jspresult>
< result name ="input" > /login.jspresult>
< action >
< package >
< struts >
<?xml
version="1.0" encoding="UTF-8"
?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" -->
< beans >
< bean id ="dataSource" class ="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method ="close" >
< property name ="driverClass" value ="oracle.jdbc.driver.OracleDriver" />
< property name ="jdbcUrl" value ="jdbc:oracle:thin:@localhost:1521:oracleDB" />
< property name ="user" value ="xxx" />
< property name ="password" value ="xxx" />
<!-- 连接池中保留的最小连接数。 -->
< property name ="minPoolSize" value ="3" />
<!-- 连接池中保留的最大连接数。Default: 15 -->
< property name ="maxPoolSize" value ="30" />
<!-- 最大空闲时间,1800秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
< property name ="maxIdleTime" value ="1800" />
<!-- 当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
< property name ="acquireIncrement" value ="3" />
< property name ="maxStatements" value ="0" />
< property name ="initialPoolSize" value ="3" />
<!-- 每60秒检查所有连接池中的空闲连接。Default: 0 -->
< property name ="idleConnectionTestPeriod" value ="60" />
<!-- 定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
< property name ="acquireRetryAttempts" value ="30" />
< property name ="breakAfterAcquireFailure" value ="true" />
< property name ="testConnectionOnCheckout" value ="false" />
< 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.Oracle9Dialectprop>
< prop key ="hibernate.show_sql" > trueprop>
< prop key ="hibernate.generate_statistics" > trueprop>
< prop key ="hibernate.connection.release_mode" > autoprop>
< prop key ="hibernate.autoReconnect" > trueprop>
< props >
< property >
< property name ="mappingDirectoryLocations" >
< list >
< value >
classpath:com/caitong/pingou/bean
< value >
< list >
< property >
< bean >
< bean id ="transactionManager" class ="org.springframework.orm.hibernate3.HibernateTransactionManager" >
< property name ="sessionFactory" >
< ref bean ="sessionFactory" />
< property >
< bean >
< bean id ="transactionInterceptor" class ="org.springframework.transaction.interceptor.TransactionInterceptor" >
< property name ="transactionManager" ref ="transactionManager" />
< property name ="transactionAttributes" >
< props >
<!-- 支持当前事务,如果当前没有事务,就新建一个事务。 -->
< prop key ="add*" > PROPAGATION_REQUIREDprop>
< prop key ="find*" > PROPAGATION_REQUIRED,readOnlyprop>
< props >
< property >
< bean >
< bean class ="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" >
< property name ="beanNames" >
< value > *Servicevalue>
< property >
< property name ="interceptorNames" >
< list >
< value > transactionInterceptorvalue>
<!-- 此处增加新的Interceptor -->
< list >
< property >
< bean >
< bean class ="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor" >
< property name ="transactionInterceptor" ref ="transactionInterceptor" />
< bean >
< bean id ="baseDAO" class ="com.caitong.pingou.dao.impl.BaseDAO" abstract ="true" >
< property name ="sessionFactory" >
< ref bean ="sessionFactory" />
property>
< bean >
< bean id ="userDAO"
class ="com.caitong.pingou.dao.impl.UserDAO" parent ="baseDAO" >
< bean >
< bean id ="userService" class ="com.caitong.pingou.service.impl.UserService"
autowire ="byName" >
< bean >
< bean id ="userAction" class ="com.caitong.pingou.action.UserAction"
autowire ="byName" >
< bean >
< beans >
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" -->
< beans >
< bean id ="dataSource" class ="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method ="close" >
< property name ="driverClass" value ="oracle.jdbc.driver.OracleDriver" />
< property name ="jdbcUrl" value ="jdbc:oracle:thin:@localhost:1521:oracleDB" />
< property name ="user" value ="xxx" />
< property name ="password" value ="xxx" />
<!-- 连接池中保留的最小连接数。 -->
< property name ="minPoolSize" value ="3" />
<!-- 连接池中保留的最大连接数。Default: 15 -->
< property name ="maxPoolSize" value ="30" />
<!-- 最大空闲时间,1800秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
< property name ="maxIdleTime" value ="1800" />
<!-- 当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
< property name ="acquireIncrement" value ="3" />
< property name ="maxStatements" value ="0" />
< property name ="initialPoolSize" value ="3" />
<!-- 每60秒检查所有连接池中的空闲连接。Default: 0 -->
< property name ="idleConnectionTestPeriod" value ="60" />
<!-- 定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
< property name ="acquireRetryAttempts" value ="30" />
< property name ="breakAfterAcquireFailure" value ="true" />
< property name ="testConnectionOnCheckout" value ="false" />
< 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.Oracle9Dialectprop>
< prop key ="hibernate.show_sql" > trueprop>
< prop key ="hibernate.generate_statistics" > trueprop>
< prop key ="hibernate.connection.release_mode" > autoprop>
< prop key ="hibernate.autoReconnect" > trueprop>
< props >
< property >
< property name ="mappingDirectoryLocations" >
< list >
< value >
classpath:com/caitong/pingou/bean
< value >
< list >
< property >
< bean >
< bean id ="transactionManager" class ="org.springframework.orm.hibernate3.HibernateTransactionManager" >
< property name ="sessionFactory" >
< ref bean ="sessionFactory" />
< property >
< bean >
< bean id ="transactionInterceptor" class ="org.springframework.transaction.interceptor.TransactionInterceptor" >
< property name ="transactionManager" ref ="transactionManager" />
< property name ="transactionAttributes" >
< props >
<!-- 支持当前事务,如果当前没有事务,就新建一个事务。 -->
< prop key ="add*" > PROPAGATION_REQUIREDprop>
< prop key ="find*" > PROPAGATION_REQUIRED,readOnlyprop>
< props >
< property >
< bean >
< bean class ="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" >
< property name ="beanNames" >
< value > *Servicevalue>
< property >
< property name ="interceptorNames" >
< list >
< value > transactionInterceptorvalue>
<!-- 此处增加新的Interceptor -->
< list >
< property >
< bean >
< bean class ="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor" >
< property name ="transactionInterceptor" ref ="transactionInterceptor" />
< bean >
< bean id ="baseDAO" class ="com.caitong.pingou.dao.impl.BaseDAO" abstract ="true" >
< property name ="sessionFactory" >
< ref bean ="sessionFactory" />
property>
< bean >
< bean id ="userDAO"
class ="com.caitong.pingou.dao.impl.UserDAO" parent ="baseDAO" >
< bean >
< bean id ="userService" class ="com.caitong.pingou.service.impl.UserService"
autowire ="byName" >
< bean >
< bean id ="userAction" class ="com.caitong.pingou.action.UserAction"
autowire ="byName" >
< bean >
< beans >