我的spring-servlet.xml中的publicId和systemId之间需要空格

时间:2013-12-06 14:51:30

标签: java spring servlets spring-mvc

我是spring框架的初学者。

当我执行应用程序时,出现以下错误:

  

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:   来自ServletContext资源的XML文档中的第1行   [/WEB-INF/spring-servlet.xml]无效;嵌套异常是   org.xml.sax.SAXParseException;的systenId:   http://www.springframework.org/schema/mvc/spring-mvc-2.5.xsd;   lineNumber:1; columnNumber:50;两者之间需要空格   publicId和systemId

的web.xml:

<?xml version="1.0" encoding="utf-8"?>
<web-app
    version="2.5"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <servlet>
       <servlet-name>spring</servlet-name>
       <servlet-class>
              org.springframework.web.servlet.DispatcherServlet
       </servlet-class>
       <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
       <servlet-name>spring</servlet-name>
       <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
</web-app>

弹簧servlet.xml中:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-2.5.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <context:component-scan base-package="com.application.myGoogleAppEngine.controller" />

    <mvc:annotation-driven />

    <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
          <property name="defaultLocale" value="fr" />
    </bean>

    <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
          <property name="paramName" value="language" />
    </bean>

    <!-- Register the welcome.properties -->
    <bean class="org.springframework.context.support.ReloadableResourceBundleMessageSource" id="messageSource"> 
        <property value="classpath:MessageBundle" name="basename"/> 
        <property value="UTF-8" name="defaultEncoding"/> 
    </bean>

    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
        <property value="org.springframework.web.servlet.view.JstlView" name="viewClass"/>
        <property name="prefix">
           <value>/WEB-INF/pages/</value>
        </property>
        <property name="suffix">
           <value>.jsp</value>
        </property>
    </bean>
</beans>

0 个答案:

没有答案