日期:2014-05-20 浏览次数:20855 次
<?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:context="http://www.springframework.org/schema/context"
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.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-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">
<context:annotation-config />
<context:component-scan base-package="com.maomao" />
<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="packagesToScan">
<list>
<value>com.maomao.model</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.hbm2ddl.auto=update
javax.persistence.validation.mode=none
</value>
</property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<constant name="stuts.i18n.encoding" value="UTF-8"></constant>
<constant name="struts.devMode" value="true" />
<package name="user" namespace="/" extends="struts-default">
<interceptors>
<interceptor name="LoginInterceptor" class="com.maomao.interceptor.LoginInterceptor"></interceptor>
</interceptors>
<global-results>
<result name="login" type="redirect">/index.jsp</result>
<result name="error" type="redirect">/login.jsp</result>
<result name="logout" type="redirect">/login.jsp</result>
</global-results>
<action name="user" class="com.maomao.action.UserAction" >
<result type="redirect">
/user.jsp
</result>
</action>
<!--
<action name="score_*" class="com.maomao.action.ScoreAction" method="{1}">
<result type="redirect">
/score_{1}.jsp
</result>
</action>
-->
</package>
<!--
<package name="admin" namespace="/admin" extends="struts-default">
<interceptors>
<interceptor name="LoginInterceptor" class="com.maomao.interceptor.LoginInterceptor"></interceptor>
</interceptors>
<global-results>
<result name="login" type="redirect">/admin/index.jsp</result>
<result name="error" type="redirect">/admin/login.jsp</result>
<result name="logout" type="redirect">/admin/login.jsp</result>
</global-results>
<action name="user_*" class="com.maomao.action.UserAction" method="{1}">
<result type="redirect">
/user_{1}.jsp
</result>
</action>
<action name="score_*" class="com.maomao.action.ScoreAction" method="{1}">
<result type="redirect">
/score_{1}.jsp
</result>
</package>
-->
<!-- Add packages here -->
</struts>