0
我正在學習Spring並構建一個示例應用程序。錯誤提示springmvc-servlet.xml錯誤,但在檢查時它看起來正確嗎?
我收到錯誤:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置問題:ServletContext的資源[:Bean的名稱 '/list_cars.html' 在此文件 犯規資源已被使用/WEB-INF/springmvc-servlet.xml]
我以前得到一個類似的錯誤爲一個springmvc-servlet.xml文件,其錯誤爲true.But,但是當我用下面的文件替換它(並刪除了以前的項目,並重新啓動Tomcat)我繼續得到錯誤,任何幫助將不勝感激。
<?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">
<!-- beans -->
<bean id="carManager" class="springmvc.service.CarManager">
<property name="carList">
<list>
<ref bean="car1"/>
<ref bean="car2"/>
</list>
</property>
</bean>
<bean id="brandManager" class="springmvc.service.BrandManager">
<property name="brandList">
<list>
<ref bean="brand1"/>
<ref bean="brand2"/>
</list>
</property>
</bean>
<bean id="brand1" class="springmvc.model.Brand">
<property name="id" value="1"/>
<property name="name" value="Mercedes"/>
<property name="country" value="Germany"/>
</bean>
<bean id="brand2" class="springmvc.model.Brand">
<property name="id" value="2"/>
<property name="name" value="Peugeot"/>
<property name="country" value="France"/>
</bean>
<bean id="car1" class="springmvc.model.Car">
<property name="id" value="1"/>
<property name="brand" ref="brand1"/>
<property name="model" value="SL 500"/>
<property name="price" value="40000"/>
</bean>
<bean id="car2" class="springmvc.model.Car">
<property name="id" value="2"/>
<property name="brand" ref="brand2"/>
<property name="model" value="607"/>
<property name="price" value="35000"/>
</bean>
<!-- urls -->
<bean name="/hello_world.html" class="springmvc.web.HelloWorldController"/>
<bean name="/list_cars.html" class="springmvc.web.CarListController">
<property name="carManager" ref="carManager"/>
</bean>
<bean name="/new_car.html" class="springmvc.web.CarNewController">
<property name="commandClass" value="springmvc.model.Car"/>
<property name="formView" value="carNew"/>
<property name="successView" value="list_cars.html"/>
<property name="validator">
<bean class="springmvc.validator.CarValidator"/>
</property>
<property name="carManager" ref="carManager"/>
<property name="brandManager" ref="brandManager"/>
</bean>
<!-- misc -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
您的應用程序必須選取其他文件,因爲在這個文件中顯然沒有重複的「/list_cars.html」定義。 – ChssPly76 2009-10-31 07:05:08