freemarker遍历集合
发表于|更新于
|浏览量:
读而未晓则思,思而未晓则读——朱熹
官方文档:https://freemarker.apache.org/docs/dgui_quickstart_template.html
语法如下:<#list sequence as loopVariable>repeatThis</#list>
例如模板如下:
1 | <p>We have these animals: |
就会生成
1 | <p>We have these animals: |
这里animal等于是数组里每一项

相关推荐
2024-06-19
h2初始化小技巧
居不幽者志不广,不愁者思不远。——冯梦龙 今天在 https://github.com/apache/incubator-streampark/pull/3759/files 看到一个小技巧 主要就是这里 1"jdbc:h2:file:%s;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true;INIT=runscript from 'classpath:db/schema-h2.sql'" 我发现可以使用 1INIT=runscript from 'classpath:db/schema-h2.sql' 拼接在url后面 这样在h2初始化时可以自动执行相关脚本,非常nice
2021-04-08
mp数据源加密
不宝金玉,而忠信以为宝。——《礼记》 在开发中,我们难免可能会担心数据库账号密码泄露 我们可以使用mybatis-plus自带的数据安全保护进行加密 123456789101112public static void main(String[] args) throws Throwable { // 生成 16 位随机 AES 密钥 String randomKey = AES.generateRandomKey(); // 随机密钥加密 String url = AES.encrypt("jdbc:mysql://localhost:3306/ruben?autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useUnicode=true&characterEncoding=utf-8&useSSL=false&nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai&...
2023-03-15
关联表更新封装
凭自己的本事和正当手段挣来的钱财,可以使我们赢得道义和幸福——阿基兰 分享一个关联更新函数 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174package com.ruben.simplestreamquery...
2022-10-19
spel获取spring bean
男人创造作品,而女人创造男人——罗曼·罗兰 代码如下: 1234567891011121314151617181920212223242526272829package com.ruben.simplebootimport org.junit.jupiter.api.Testimport org.springframework.beans.factory.BeanFactoryimport org.springframework.beans.factory.annotation.Autowiredimport org.springframework.boot.test.context.SpringBootTestimport org.springframework.context.expression.BeanFactoryResolverimport org.springframework.expression.spel.standard.SpelExpressionParserimport org.springframework.expression.spel.suppo...
2021-07-22
创建只读集合
真正的人生,只有在经过艰难卓绝的斗争之后才能实现。——塞涅卡 在java8中 我们可以使用下面的函数创建只读集合 12345678Collections.unmodifiableCollection(Arrays.asList(""));Collections.unmodifiableList(Collections.singletonList(""));Collections.unmodifiableMap(new HashMap<>(1 << 4));Collections.unmodifiableSet(new HashSet<>());Collections.unmodifiableNavigableMap(new TreeMap<>());Collections.unmodifiableNavigableSet(new TreeSet<>());Collections.unmodifiableSortedMap(new TreeMap<>());Colle...
2020-10-07
java反编译class
让我们不要用过去的哀悉拖累我们的记忆。——莎士比亚 反编译class为java文件,我们可以用到jad 下载 使用方式: 首先解压jar包 在jad所在目录下执行 1jad.exe -r -ff -d D:\mc\source\FortuneTelling -s java D:\mc\source\original-FortuneTelling-1.0-SNAPSHOT\**\*.class ps: 1jad.exe -r -ff -d [反编译后代码存放路径] -s java [需要反编译包含class的目录]\**\*.class 帮助 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810...

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog