当前位置: 代码迷 >> J2EE >> ssh 中action bean的接口参数总不能传到,why
  详细解决方案

ssh 中action bean的接口参数总不能传到,why

热度:1430   发布时间:2013-02-25 21:40:23.0
ssh 中action bean的接口参数总不能传入,why?
我用的myeclipse 9.0 + struts 2.1+spring 3.0 +hibernate 3.3
当我调试时得知, action bean UsersAction的usersService参数值总为空(action bean的接口参数总不能传入)? why?

applicatonContext.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:p="http://www.springframework.org/schema/p"
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/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="net.sourceforge.jtds.jdbc.Driver">
</property>
<property name="url"
value="jdbc:jtds:sqlserver://127.0.0.1:1433;DatabaseName=testdb">
</property>
<property name="username" value="sa"></property>
<property name="password" value="123456"></property>
</bean>

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/login/Users.hbm.xml</value></list>
</property></bean>

<bean id="UsersDAO" class="com.login.UsersDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>

<bean id="UsersService" class="com.login.UsersService">
 <property name="usersDAO" ref="UsersDAO" />
</bean>

<bean id="UsersAction" class="com.login.UsersAction">
 <property name="usersService" ref="UsersService" />
</bean>

<bean id="transactionManager"    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
 <property name="sessionFactory">
 <ref bean="sessionFactory" />
 </property>
</bean>

<tx:advice id="txAdvice" transaction-manager="transactionManager">
 <tx:attributes>
 <tx:method name="save*" propagation="REQUIRED" />
 <tx:method name="update*" propagation="REQUIRED" />
 <tx:method name="delete*" propagation="REQUIRED" />
 <tx:method name="add*" propagation="REQUIRED" />
 <tx:method name="del*" propagation="REQUIRED" />
 <tx:method name="*" read-only="true" />
  相关解决方案