url-pattern异常

Description Resource Path Location Type

cvc-complex-type.2.4.a: Invalid content was found starting with element 'url-pattern'. One of '{"http://java.sun.com/xml/ns/javaee":servlet-name}' is expected. web.xml /hrblog/WebContent/WEB-INF line 18 XML Problem 原因 在web.xml中声明servlet、servlet-mapping时,尤其实在servlet-mapping中,应该先声明servlet-name,再声明url-pattern,否则会报异常