<servlet> <servlet-name>WelcomeServlet</servlet-name> <servlet-class>org.jiye.servlet.WelcomeServlet</servlet-class> <load-on-startup>1</load-on-startup> <init-param> <param-name>initParam</param-name> <param-value>init</param-value> </init-param> </servlet>
报错:
Multiple annotations found at this line:
– cvc-complex-type.2.4.a: Invalid content was found starting with element ‘init-param’. One of
‘{“http://java.sun.com/xml/ns/javaee”:run-as, “http://java.sun.com/xml/ns/javaee”:security-role-ref}’ is
expected.
– Invalid element name:
– init-param
– cvc-complex-type.2.4.a: Invalid content was found starting with element ‘init-param’. One of
‘{“http://java.sun.com/xml/ns/javaee”:run-as, “http://java.sun.com/xml/ns/javaee”:security-role-ref}’ is
expected.
– Invalid element name:
– init-param
One of the following is expected:
– run-as
– security-role-ref
Error indicated by:
{http://java.sun.com/xml/ns/javaee}
with code:
嗯?什么玩意儿??运行不是挺正常的吗。。。
不过,换了个顺序就正常了:
<servlet> <servlet-name>WelcomeServlet</servlet-name> <servlet-class>org.jiye.servlet.WelcomeServlet</servlet-class> <init-param> <param-name>initParam</param-name> <param-value>init</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>
奇奇怪怪的 #(喷)