(xml)cvc-complex-type.2.4.a:从元素' init-param'开始发现无效内容。

时间:2018-03-15 17:01:12

标签: java xml spring

我不知道造成这个错误的原因。

请帮我修复此错误。

enter image description here

cvc-complex-type.2.4.a:找到以元素' init-param'开头的无效内容。其中一个' {" http://java.sun.com/xml/ns/javaee":module-name," http://  java.sun.com/xml/ns/javaee":description," http://java.sun.com/xml/ns/javaee":display-name," http://java.sun.com/xml/ns/javaee":icon ," http://  java.sun.com/xml/ns/javaee":distributable," http://java.sun.com/xml/ns/javaee":context-param," http://java.sun.com/xml/ns/javaee":filter ," http://  java.sun.com/xml/ns/javaee":filter-mapping," http://java.sun.com/xml/ns/javaee":listener," http://java.sun.com/xml/ns/javaee":servlet ," http://java.sun.com/  xml / ns / javaee":servlet-mapping," http://java.sun.com/xml/ns/javaee":session-config," http://java.sun.com/xml/ns/javaee":mime-mapping,& #34; HTTP://  java.sun.com/xml/ns/javaee":welcome-file-list," http://java.sun.com/xml/ns/javaee":error-page," http://java.sun.com/xml/ns/javaee&# 34;:jsp-config," http://  java.sun.com/xml/ns/javaee" ;:security-constraint," http://java.sun.com/xml/ns/javaee":login-config," http://java.sun.com/xml/ns/javaee" :安全性的作用,  " http://java.sun.com/xml/ns/javaee":env-entry," http://java.sun.com/xml/ns/javaee":ejb-ref," http://java.sun.com/xml/ns/javaee": ejb-local-ref," http://  java.sun.com/xml/ns/javaee":service-ref," http://java.sun.com/xml/ns/javaee":resource-ref," http://java.sun.com/xml/ns/javaee" :resource-env-ref," http://  java.sun.com/xml/ns/javaee":message-destination-ref," http://java.sun.com/xml/ns/javaee":persistence-context-ref," http://java.sun.com/xml/ns/  javaee":persistence-unit-ref," http://java.sun.com/xml/ns/javaee":post-construct," http://java.sun.com/xml/ns/javaee":pre-destroy,&#34 ; http://java.sun.com/  xml / ns / javaee":data-source," http://java.sun.com/xml/ns/javaee":message-destination," http://java.sun.com/xml/ns/javaee":locale-encoding-mapping -list,  " http://java.sun.com/xml/ns/javaee":绝对排序}'是预期的。

1 个答案:

答案 0 :(得分:0)

<init-param>标记应位于<servlet>标记内,如下所示:

<servlet>
  <servlet-name></servlet-name>
  <servlet-class></servlet-class>
  <init-param>
    <param-name></param-name>
    <param-value></param-value>
  </init-param>
</servlet>