Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在my spring-servlet.xml中,publicId和systemId之间需要空格_Java_Spring_Servlets_Spring Mvc - Fatal编程技术网

Java 在my spring-servlet.xml中,publicId和systemId之间需要空格

Java 在my spring-servlet.xml中,publicId和systemId之间需要空格,java,spring,servlets,spring-mvc,Java,Spring,Servlets,Spring Mvc,我是spring框架的初学者 执行应用程序时,出现以下错误: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: ServletContext资源的XML文档中的第1行 [/WEB-INF/spring servlet.xml]无效;嵌套异常是 org.xml.sax.SAXParseException;系统ID: ; 行号:1;栏目号:50;之间需要空白 publicId和systemId web.xml

我是spring框架的初学者

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

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: ServletContext资源的XML文档中的第1行 [/WEB-INF/spring servlet.xml]无效;嵌套异常是 org.xml.sax.SAXParseException;系统ID: ; 行号:1;栏目号: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>
<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>

春天
org.springframework.web.servlet.DispatcherServlet
1.
春天
*.jsp
springservlet.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>
<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>

/WEB-INF/pages/
.jsp