ssm框架下的报错:java.lang.NullPointerException: target is null for method trim
扫描二维码
随时随地手机看文章
### Error querying database. Cause: java.lang.NullPointerException: target is null for method trim
### Cause: java.lang.NullPointerException: target is null for method trim
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.NullPointerException: target is null for method trim
### Cause: java.lang.NullPointerException: target is null for method trim
我的错误是在ssm框架下的项目的报错,因为我使用了select下拉框,在mybatis动态sql语句中我使用了
AND start LIKE concat('%',#{start},'%')
一开始一直找不到错误,因为我其他的int或者string类型的在if标签中也用了trim(),都没有问题,最后找出问题是不用加.trim().
AND start LIKE concat('%',#{start},'%')
如果你觉得这样你不放心,可以这样使用
AND start LIKE concat('%',#{start},'%')