SPRINGMVC problem no mapping found for HTTP request with URI

Source: Internet
Author: User

Do a block into the database operation:

Applicaition.xml configuration:

<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:tx= "Http://www.springframework.org/schema/tx"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"Xmlns:context= "Http://www.springframework.org/schema/context"xmlns:p= "http://www.springframework.org/schema/p"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-3.2.xsd Http://www.springframework.org/schema/context Http://www.springframework.org/schema/context /spring-context-3.2.xsd Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/ Spring-tx-3.2.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/ Spring-aop-3.2.xsd ">    <!--Configure the data source, remember to remove the Mybatis-config.xml data source related configuration -    <BeanID= "DataSource"class= "Com.mchange.v2.c3p0.ComboPooledDataSource">        < Propertyname= "Driverclass"value= "Com.mysql.jdbc.Driver" />        < Propertyname= "Jdbcurl"value= "Jdbc:mysql://localhost:3306/mybatis2?useunicode=true&amp;characterencoding=utf-8" />        < Propertyname= "User"value= "root" />        < Propertyname= "Password"value= "123456" />    </Bean>    <!--Configuring the Session factory -    <BeanID= "Sqlsessionfactory"class= "Org.mybatis.spring.SqlSessionFactoryBean">        < Propertyname= "DataSource"ref= "DataSource" />        < Propertyname= "Configlocation"value= "Classpath:mybatis-config.xml" />    </Bean>    <!--Configure the transaction manager to manage data source transactions -    <BeanID= "TransactionManager"class= "Org.springframework.jdbc.datasource.DataSourceTransactionManager">        < Propertyname= "DataSource"ref= "DataSource" />    </Bean>    <!--Configuring transaction Notifications -    <Tx:adviceID= "Advice"Transaction-manager= "TransactionManager">        <tx:attributes>            <!--only run-time exceptions are handled by default and can be added rollback-for= "exception/throwable" to handle all exceptions or include errors -            <Tx:methodname= "insert*"Propagation= "REQUIRED"rollback-for= "Exception" />            <Tx:methodname= "update*"Propagation= "REQUIRED"rollback-for= "Exception" />            <Tx:methodname= "delete*"Propagation= "REQUIRED"rollback-for= "Exception" />            <Tx:methodname="*"Propagation= "SUPPORTS" />        </tx:attributes>    </Tx:advice>    <!--configuration of sessiontemplate, packed with tedious data operations -    <BeanID= "Sqlsessiontemplate"class= "Org.mybatis.spring.SqlSessionTemplate"Scope= "Prototype">        <Constructor-argname= "Sqlsessionfactory"ref= "Sqlsessionfactory" />    </Bean>    <!--Configure the extent in which the facets are woven, and then set the transaction boundary to the service layer -    <Aop:config>        <Aop:advisorAdvice-ref= "Advice"pointcut= "Execution (* com.liuyang.crm.service.imp.*.* (..))" />    </Aop:config>    <Context:component-scanBase-package= "Com.liuyang" />    <!--context:exclude-filter type= "annotation" expression= "Org.springframework.stereotype.Controller"/> </con Text:component-scan -</Beans>

Shielding against erroneous data entry

<base-package= "Com.liuyang"/>    <!--context: Exclude-filter type= "Annotation" expression= "Org.springframework.stereotype.Controller"         -

This is actually written off, it is also very handy. Plus, it appears that the top of the article does not find the URL address injection error.

Spring-mvc.xml

<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:mvc= "Http://www.springframework.org/schema/mvc"Xmlns:context= "Http://www.springframework.org/schema/context"xmlns:p= "http://www.springframework.org/schema/p"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-3.2.xsd Http://www.springframework.org/schema/context Http://www.springframework.org/schema/context /spring-context-3.2.xsd Http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/ Spring-mvc-3.2.xsd ">        <!--Enable JSON format support at the same time -    <Mvc:annotation-driven></Mvc:annotation-driven>        <Context:component-scanBase-package= "Com.liuyang">        <Context:include-filtertype= "Annotation"expression= "Org.springframework.stereotype.Controller" />        <Context:exclude-filtertype= "Annotation"expression= "Org.springframework.stereotype.Service" />    </Context:component-scan></Beans>

You can configure the mask here so that the database does not enter the error data.

<Context:component-scanBase-package= "Com.liuyang">        <Context:include-filtertype= "Annotation"expression= "Org.springframework.stereotype.Controller" />        <Context:exclude-filtertype= "Annotation"expression= "Org.springframework.stereotype.Service" />    </Context:component-scan>
@Overridepublic int insertdept (Dept Dept) throws Exception {int i = 0;i = Deptdao.insertdept (Dept); Integer.parseint ("AA") ; return i;}

Hope to help you, thank you for watching.

SPRINGMVC problem no mapping found for HTTP request with URI

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.