例:
<foreach collection="plantset_types" item="plant" separator="," open="'" close="'">
${plant.plant_id}
</foreach>
每个${plant.plant_id}获取的值前后都会自动加空格,‘ 1 , 2 , 3’。
使用下面方法去除空格:
replace(<foreach collection="plantset_types" item="plant" separator="," open="'" close="'">
${plant.plant_id}
</foreach>,' ','')
使用SQL语句的replace方法,去掉所有的空格(缺点:去掉所有的空格)。
replace(‘字符串’,‘ ’,‘’)。