大虾门,帮小弟解决个问题白
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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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">
<!-- 配置Hibernate的数据库连接,托管给Spring来生成SessionFactory对象 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="loginDAO" class="com.gw.dao.impl.LoginDAOImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="loginService" class="com.gw.service.impl.LoginServiceImpl">
<property name="dao" ref="loginDAO"></property>
</bean>
<bean name="loginBean" class="com.gw.action.LoginAction">
<property name="service" ref="loginService"></property>
</bean>
<!-- 进行事务的配置,使用Aop方式进行声明 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<aop:config proxy-target-class="true"/>
<aop:config>
<aop:advisor advice-ref="txAdvice" pointcut="execution(* com.gw.service..*ServiceImpl.*(..))"/>
</aop:config>
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="get*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
</beans>
sturts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.objectFactory" value="spring"></constant>
<package name="default" extends="struts-default">
<action name="loginAction" class="com.gw.action.LoginAction">
<result name="success">/menu.jsp</result>
<result name="fail">/error.jsp</result>
</action&