mybatis在xml文件中处理小于等于号的方法
2017-07-03 09:46
211 查看
如上图所示,在MyBatis的XML映射文件中使用小于等于号<= 报错,大于等于号则可以正常使用。
解决:
1、进行转义
< | < | 小于号 |
> | > | 大于号 |
& | & | 和 |
' | ' | 单引号 |
" | " | 双引号 |
<select id="getPersons" resultType="cn.bjut.entity.Person"> SELECT * FROM persons WHERE age >= #{param1} AND age <= #{param2} </select>
2、使用CDATA
CDATA里面的内容不进行解析。
<select id="getPersons" resultType="cn.bjut.entity.Person"> <![CDATA[ SELECT * FROM persons WHERE age >= #{param1} AND age <= #{param2} ]]> </select>
相关文章推荐
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- MyBatis学习 之 六、 mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理特殊符号(大于号小于号等的方法)
- mybatis在xml文件中处理大于号小于号的方法
- mybatis在xml文件中处理大于号小于号的方法
- MyBatis中小于等于号的处理
- mybatis在xml文件中处理大于号小于号的方法