Mybatis Inserts Data Scrambling Problem?

  java, question

<! — Mysql database configuration->

<bean id=”ds” class =”org.apache.commons.dbcp.BasicDataSource”>

<property name="url" value="jdbc:mysql://192.168.0.60:3306/material?useUnicode=true&    amp;characterEncoding=UTF-8"/> 
<property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="username" value="root"/> 
<property name="password" value="admin"/>

</bean>
The system uses springMVC plus Mybatis, and the web.xml has been configured as shown in the figure:图片描述

And Mysql has a unified code图片描述

It is normal to print out the attributes that jsp sends back to the background, only to report an error by executing sql insertion through xml in mybatis, and ask Great God for advice! ! !

在数据源(mysql)配置上url加上&characterEncoding=utf8,具体的url可见value=”jdbc:mysql://127.0.0.1:3306/material?useUnicode=true&characterEncoding=utf8&autoReconnect=true”。保证请求与相应,页面以及数据库层操作保持utf-8的编码