码迷,mamicode.com
首页 > 数据库 > 详细

Mybatis sql注入问题

时间:2016-03-18 09:26:19      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:

预编译方式,即PreparedStatement,可以防注入:#{id}

<select id="getBlogById" resultType="Blog"parameterType=”int”>

select id,title,author,content from blog where id=#{id}

</select>

 字符串拼接方式,容易产生注入:${id}

<select id="getBlogById" resultType="Blog"parameterType=”int”>

select id,title,author,content from blog where id=${id}

</select>

Mybatis sql注入问题

标签:

原文地址:http://www.cnblogs.com/SEC-fsq/p/5290681.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!