错误描述

### SQL: insert into t_customer(name,gender,phone,address)    values (?,?,?,?)
### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'gender' at row 1

错误原因

可能是页面提交表单如下:value值为字符男或女,web.xml中又没有设置编码过滤器,导致提交的中文男或女产生了乱码,长度大于了数据库字段gender(类型可能为char)的长度

客户性别:
<input type="radio" name="gender" value="男">男
<input type="radio" name="gender" value="女">女<br/>

解决办法

在web.xml增加编码过滤器配置

<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

SSM整合中错误:Data truncation: Data too long for column 'gender' at row 1的更多相关文章

  1. Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'createtime' at row 1...

    之前项目一直好好的,之后电脑重装系统,数据库重新安装了一个5.6版本的,项目jar包丢失了,之后就又重新找了一些jar包倒入,结果运行报错: Caused by: com.mysql.jdbc.Mys ...

  2. ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - Data truncation: Incorrect datetime value: '' for column 'pubdate' at row 1

    之前的Connector/J版本是:mysql-connector-java-5.0.4-bin.jar 后来换成mysql-connector-java-5.1.45-bin.jar,问题解决 20 ...

  3. Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'img' at row 1故障

    Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'img' at ro ...

  4. 数据库报错com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'ua' at row 1

    记一次报错记录,成长路上的点滴 明明使用浏览器或者微信开发工具调试接口没有问题,但是在真机测试时候就出问题了.(((¬_¬)) 500服务器内部错误,要死的节奏啊 登陆tomcat服务器 使用命令ta ...

  5. 插入UUID,出现Data truncation: Data too long for column 'id' at row 1

    ssc.udf.register("getuuid", () => UUID.randomUUID().toString) val stuPCountDF_tmp1=ssc. ...

  6. Data truncation: Data too long for column 'id' at row 1

    Caused by: java.sql.BatchUpdateException: Data truncation: Data too long for column 'titleimg' at ro ...

  7. SSM整合中遇到的不能扫描注解的bug

    我的开发环境为: ubuntu14.04LTS 64bit; Spring Tool Suite  3.5.0.RELEASE Maven 3.2.3 SSM整合中遇到的不能扫描注解的bug 最终解决 ...

  8. Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'content' a

    1.错误描述 org.hibernate.exception.DataException: could not execute statement at org.hibernate.exception ...

  9. Data truncation: Data too long for column 'content' at row 1

    项目运行报错: Data truncation: Data too long for column 'content' at row 1 是由于字段长度太小导致的 搜索mysql 中text 字段长度 ...

随机推荐

  1. 2、maven仓库位置设置

    根据我们maven的安装目录找到config文件夹,并找到下面的setting.xml文件,在该文件里面添加下面的代码: <localRepository>F:\apache-maven- ...

  2. java dwg转svg

    package com.example.demo.dxf2svg; import com.aspose.cad.InterpolationMode; import com.aspose.cad.Smo ...

  3. lnmp 安装 访问 配置 laravel

    环境要求 Lnmp 一键安装包安装 php7.2+ Mysql 5.7 Innodb 开启 第一步 上传项目到 /home/wwwroot/default/ 或者composer命令行安装larave ...

  4. C# user32.dll 找窗口 填数据

    工具:SpyLite [DllImport("user32.dll", EntryPoint = "FindWindow")] private extern s ...

  5. IntlliJ IDEA 注册码获取或离线破解

    JB 的软件还是挺好用的,建议有钱的话支持正版.. IntelliJ IDEA 有开源版,但是要想玩企业级开发,还是得用收费版. 不管哪种方式,使用前都需要把"0.0.0.0 account ...

  6. 匿名函数及paramiko模块

    1.匿名函数 随着程序代码的不断增加,起名字其实也是非常困难的一件事 一些简单的功能完全没必要用def函数,匿名函数足矣 def test(x,y): return x+y res = test(1, ...

  7. Java本周总结1

    这两周我上认真的课应该就是李老师的课了/ 第一周主要跟我们讲述了java的发展史何java开发环境的搭建,带领我们走进了java,李老师的精彩讲述让我们对Java有了深刻的认识/. jdk下载安装包我 ...

  8. [DS+Algo] 007 希尔排序及其代码实现

    步骤 将数组列在一个表(一行多列)中,按特定的步长进行插入排序 步长从 length/2 到 1,每次除 2 将数组转换至表是为了更好地理解这算法,算法本身还是使用数组进行排序 算法性能 (根据步长序 ...

  9. qt 部分控件 setStyleSheet 使用总结

    刚用Qt不久,但是已经感受到Qt ui设计的便捷. 总结一下最近使用的控件,把它们setStyleSheet的使用方法记录下来. 主要使用到的工具有:QToolBar,QToolBox,QPushBu ...

  10. CyclicBarrier、CountDownLatch、Callable、FutureTask、thread.join() 、wait()、notify()、Condition

    CyclicBarrier使用: import java.util.Random; import java.util.concurrent.BrokenBarrierException; import ...