日期:2014-05-20  浏览次数:20734 次

整合SSH出现的No bean named '/addUser' is defined错误
我的spring配置
<?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.5.xsd">


<bean id="mysql" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/hr"></property>
<property name="username" value="root"></property>
<property name="password" value="123"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="mysql" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>net/xie/hr/entity/Roles.hbm.xml
</value>
<value>net/xie/hr/entity/Groups.hbm.xml
</value>
<value>net/xie/hr/entity/Rights.hbm.xml
</value>
<value>net/xie/hr/entity/User.hbm.xml
</value>
</list>
</property>
</bean>
<bean id="RolesDAO" class="net.xie.hr.dao.RolesDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="GroupsDAO" class="net.xie.hr.dao.GroupsDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="RightsDAO" class="net.xie.hr.dao.RightsDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="UserDAO" class="net.xie.hr.dao.UserDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="UsersBiz" class="net.xie.hr.biz.UserBiz">
<property name="userDAO">
<ref bean="UserDAO" />
</property>
</bean>
<bean name="addUser" class="net.xie.struts.action.AddUserAction">
<property name="biz">
<ref bean="UsersBiz" />
</property>
</bean>
</beans>


我的sturts配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" 
  "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<struts-config>
  <data-sources />
  <form-beans >
  <form-bean name="addUserForm" type="net.xie.struts.form.AddUserForm" />

  </form-beans>

  <global-exceptions />
  <global-forwards />
  <action-mappings >
  <action
  attribute="addUserForm"