SPRINGMVC mvc:exclude-mapping Error Hints

Source: Internet
Author: User

When building a Java Web project today, a login blocker is added, and the main feature is that users who are not logged on will not be able to access any of the system's pages.

Let's start with the version of my Web project SPRINGMVC and the interceptor that I just started configuring:

Springmvc 4.3.7

1 <!--Interception Device -2     <mvc:interceptors>3         <!--Login Blocker -4         <Mvc:interceptor>5             <mvc:exclude-mappingPath= "/login"/>6             <mvc:exclude-mappingPath="/"/>7             <mvc:exclude-mappingPath= "/dologin"/>8             <mvc:exclude-mappingPath= "/loginout"/>9             <mvc:mappingPath="/**"/>Ten             <Beanclass= "Org.yi.lc.web.common.interceptor.LoginInterceptor"/> One         </Mvc:interceptor> A     </mvc:interceptors>

However, when the spring-servlet.xml configuration of this interceptor, the tool has been error, the operation of the following errors:

1Org.xml.sax.SAXParseException; linenumber:27; columnnumber:49; CVC-COMPLEX-TYPE.2.4.A: Found invalid content starting with element ' mvc:exclude-mapping '. Should be ' {' HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/MVC ': mapping} 'one of the openings. 2At Com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (Errorhandlerwrapper.java : 203)3At Com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error (errorhandlerwrapper.java:134)4At Com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (xmlerrorreporter.java:396)5At Com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (xmlerrorreporter.java:327)6At Com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (xmlerrorreporter.java:284)7At Com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator$xsierrorreporter.reporterror ( xmlschemavalidator.java:452)8At Com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError (xmlschemavalidator.java:3230)9At Com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement (Xmlschemavalidator.java : 1790)TenAt Com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement (xmlschemavalidator.java:760) OneAt Com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement ( xmlnsdocumentscannerimpl.java:351)

This error hint at first didn't understand, thought is not support mvc:exclude-mapping, then Baidu reason, various solutions, such as replace Jar package.

From the corresponding schema http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd view, found that there is this tag, which means that my version is obviously supported, then this newspaper wrong what meaning?

Later notice in the error prompt "Beginning" Two words, if do not start with mvc:exclude-mapping is OK, try a bit, sure enough!

Attach the correct sequence of configurations:

<!--Interception Device -    <mvc:interceptors>        <!--Login Blocker -        <Mvc:interceptor>            <mvc:mappingPath="/**"/>            <mvc:exclude-mappingPath= "/login"/>            <mvc:exclude-mappingPath="/"/>            <mvc:exclude-mappingPath= "/dologin"/>            <mvc:exclude-mappingPath= "/loginout"/>            <Beanclass= "Org.yi.lc.web.common.interceptor.LoginInterceptor"/>        </Mvc:interceptor>    </mvc:interceptors>

SPRINGMVC mvc:exclude-mapping Error Hints

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.