exception javax.servlet.ServletException:
Servlet.init() for servlet Dispatcher threw exception org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testMapping' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'testAction' is defined
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:451) org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'testAction' is defined 我的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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="testMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/test.do">testAction </prop>
</props>
</property>
</bean>
<!-- 定义Action -->
<bean id="testActin"
class="com.demo.spring.actions.TestAction">
<property name="commandClass">
<value>com.demo.spring.forms.TestForm </value>
</property>
<!-- 指定失败要还回的页面 -->
<property name="formView">
<value>input </value>
</property>
<!-- 指定成功要还回的页面 -->
<property name="successView">
<value>success </value>
</property>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.InternalResourceView </value>
</property>
<!-- jsp都放在/目录下 -->
<property name="prefix">
<value>/ </value>
</property>
<!-- jsp页面的后缀都是.jsp -->
<property name="suffix">
<value>.jsp </value>
</property>
</bean>
</beans> 搞不懂 怎么回事?
还请高手指教
Servlet.init() for servlet Dispatcher threw exception org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testMapping' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'testAction' is defined
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:451) org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'testAction' is defined 我的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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="testMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/test.do">testAction </prop>
</props>
</property>
</bean>
<!-- 定义Action -->
<bean id="testActin"
class="com.demo.spring.actions.TestAction">
<property name="commandClass">
<value>com.demo.spring.forms.TestForm </value>
</property>
<!-- 指定失败要还回的页面 -->
<property name="formView">
<value>input </value>
</property>
<!-- 指定成功要还回的页面 -->
<property name="successView">
<value>success </value>
</property>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.InternalResourceView </value>
</property>
<!-- jsp都放在/目录下 -->
<property name="prefix">
<value>/ </value>
</property>
<!-- jsp页面的后缀都是.jsp -->
<property name="suffix">
<value>.jsp </value>
</property>
</bean>
</beans> 搞不懂 怎么回事?
还请高手指教
你这个ID是从哪来的<bean id="testActin"