本文主要是介绍配置SpringMVC的init-param标签时的错误cvc-complex-type.2.4.a,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
配置web.xml中dispatcherServlet的初始化上下文路径时,出现如下错误:
配置文件信息如下:
-
- <servlet>
- <servlet-name>dispatcherContext</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <load-on-startup>1</load-on-startup></span>
- <init-param>
- <param-name>contextConfigLocationServlet</param-name>
- <param-value>/xxxxxxxxx/dispatcherContext-servlet.xml</param-value>
- </init-param></span>
- </servlet>
- <servlet-mapping>
- <servlet-name>dispatcherContext</servlet-name>
- <url-pattern>/</url-pattern>
- </servlet-mapping>
将<init-param></init-param>标签对和<load-on-startup></load-on-startup>标签对顺序调换一下就可以了:
- <servlet>
- <servlet-name>dispatcherContext</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>contextConfigLocationServlet</param-name>
- <param-value>/xxxxxxxx/dispatcherContext-servlet.xml</param-value>
- </init-param></span>
- <load-on-startup>1</load-on-startup></span>
- </servlet>
- <servlet-mapping>
- <servlet-name>dispatcherContext</servlet-name>
- <url-pattern>/</url-pattern>
- </servlet-mapping>
这篇关于配置SpringMVC的init-param标签时的错误cvc-complex-type.2.4.a的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!