淡语

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

随笔分类 -  Velocity

Velocity模板引擎
Velocity动态拼接字符串
摘要://定义空的字符串 #set($attrListStr = "") //遍历一个list来开始拼接 #foreach ($listItem in $!{list}) #set($attrListStr=$attrListStr+$listItem.columnName+",") #end 输出字符串 阅读全文

posted @ 2020-12-28 10:22 object360 阅读(862) 评论(0) 推荐(0) 编辑

Velocity遍历Map对象
摘要:#foreach($item in $!indexMap.entrySet()) 输出Map的key: $!{item.key} 输出Map的value:$!{item.value} 如果Map的value是一个list,还可以继续遍历 #foreach ($listItem in $!{item. 阅读全文

posted @ 2020-12-28 10:19 object360 阅读(659) 评论(0) 推荐(0) 编辑

Velocity紧邻的字符串拼接,在变量后面紧邻拼接字符串
摘要:#set($attrListStr = "abc") 使用${attrListStr }List输出abcList无效 应使用$!{attrListStr}List 阅读全文

posted @ 2020-12-28 10:15 object360 阅读(373) 评论(0) 推荐(0) 编辑

Velocity截取字符串
摘要:1.根据长度截取 #set($attrListStr = "123aabb") #set($attrListStr=$attrListStr.substring(0,4)) 2.根据字符串长度来截取,如截取到末尾最后一个,移除逗号 #set($attrListStr = "123aabb,") #s 阅读全文

posted @ 2020-12-28 10:07 object360 阅读(1650) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示