当前位置: 代码迷 >> J2EE >> SSH集成中org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '/add' is defined出错,该怎么处理
  详细解决方案

SSH集成中org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '/add' is defined出错,该怎么处理

热度:508   发布时间:2016-04-22 01:24:40.0
SSH集成中org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '/add' is defined出错
---------ApplicationContext-common.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
  <!-- 配置数据源 -->
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"></property>
  <property name="url" value="jdbc:microsoft:sqlserver://localhost:1433;DataBaseName=pubs"></property>
  <property name="username" value="sa"></property>
  </bean>
  <!-- 配置SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
 <property name="configLocation">
  <value>classpath:hibernate.cfg.xml</value>
 </property>
 <property name="dataSource" ref="dataSource"></property>
</bean>
</beans>
-----------------ApplicationContext-action.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean name="/add" class="com.east.ssh.web.action.UserInfoAction">
  <property name="userBiz" ref="userBiz"></property>
</bean>

</beans>
-----------------ApplicationContext-bean.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="userImpl" class="com.east.ssh.dao.impl.UserDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>

<bean id="userBiz" class="com.east.ssh.biz.UserInfoBiz">
<property name="iuserDao" ref="userImpl"></property>
</bean>

</beans>
----------------jsp----------------
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   
  <title>SSH集成</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">  
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
  相关解决方案