简体   繁体   English

在Spring MVC项目的web.xml中获取错误

[英]Getting error in web.xml for spring mvc project

I am creating Spring MVC project. 我正在创建Spring MVC项目。

In web.xml at <spring-class>org.springframework.web.servlet.DispatcherServlet</spring-class> 在web.xml中的<spring-class>org.springframework.web.servlet.DispatcherServlet</spring-class>

I am getting this error 我收到此错误

"cvc-complex-type.2.4.a: Invalid content was found starting with element 'spring- class'. One of {"http://xmlns.jcp.org/xml/ns/javaee":servlet-class, "http:// xmlns.jcp.org/xml/ns/javaee":jsp-file, "http://xmlns.jcp.org/xml/ns/javaee":init- param, "http://xmlns.jcp.org/xml/ns/javaee":load-on-startup, "http://xmlns.jcp.org/ xml/ns/javaee":enabled, "http://xmlns.jcp.org/xml/ns/javaee":async-supported,
"http://xmlns.jcp.org/xml/ns/javaee":run-as, "http://xmlns.jcp.org/xml/ns/ javaee":security-role-ref, "http://xmlns.jcp.org/xml/ns/javaee":multipart-config}
“ cvc-complex-type.2.4.a:发现从元素'spring-class'开始的无效内容。 {"http://xmlns.jcp.org/xml/ns/javaee":servlet-class, "http:// xmlns.jcp.org/xml/ns/javaee":jsp-file, "http://xmlns.jcp.org/xml/ns/javaee":init- param, "http://xmlns.jcp.org/xml/ns/javaee":load-on-startup, "http://xmlns.jcp.org/ xml/ns/javaee":enabled, "http://xmlns.jcp.org/xml/ns/javaee":async-supported,
"http://xmlns.jcp.org/xml/ns/javaee":run-as, "http://xmlns.jcp.org/xml/ns/ javaee":security-role-ref, "http://xmlns.jcp.org/xml/ns/javaee":multipart-config}
{"http://xmlns.jcp.org/xml/ns/javaee":servlet-class, "http:// xmlns.jcp.org/xml/ns/javaee":jsp-file, "http://xmlns.jcp.org/xml/ns/javaee":init- param, "http://xmlns.jcp.org/xml/ns/javaee":load-on-startup, "http://xmlns.jcp.org/ xml/ns/javaee":enabled, "http://xmlns.jcp.org/xml/ns/javaee":async-supported,
"http://xmlns.jcp.org/xml/ns/javaee":run-as, "http://xmlns.jcp.org/xml/ns/ javaee":security-role-ref, "http://xmlns.jcp.org/xml/ns/javaee":multipart-config}
{"http://xmlns.jcp.org/xml/ns/javaee":servlet-class, "http:// xmlns.jcp.org/xml/ns/javaee":jsp-file, "http://xmlns.jcp.org/xml/ns/javaee":init- param, "http://xmlns.jcp.org/xml/ns/javaee":load-on-startup, "http://xmlns.jcp.org/ xml/ns/javaee":enabled, "http://xmlns.jcp.org/xml/ns/javaee":async-supported,
"http://xmlns.jcp.org/xml/ns/javaee":run-as, "http://xmlns.jcp.org/xml/ns/ javaee":security-role-ref, "http://xmlns.jcp.org/xml/ns/javaee":multipart-config}
is
{"http://xmlns.jcp.org/xml/ns/javaee":servlet-class, "http:// xmlns.jcp.org/xml/ns/javaee":jsp-file, "http://xmlns.jcp.org/xml/ns/javaee":init- param, "http://xmlns.jcp.org/xml/ns/javaee":load-on-startup, "http://xmlns.jcp.org/ xml/ns/javaee":enabled, "http://xmlns.jcp.org/xml/ns/javaee":async-supported,
"http://xmlns.jcp.org/xml/ns/javaee":run-as, "http://xmlns.jcp.org/xml/ns/ javaee":security-role-ref, "http://xmlns.jcp.org/xml/ns/javaee":multipart-config}

expected." 预期。”

Could anyone help me out with this 谁能帮我这个忙

Without having your complete web.xml posted it is hard to determine but from what you posted I believe your issue maybe the space between the hyphen and class. 没有发布完整的web.xml,很难确定,但是根据您发布的内容,我相信您的问题可能是连字符和类之间的间隔。

You have 'spring- class' but it should be 'spring-class' 您有'spring- class'但应该是'spring-class'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM