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等于是数组里每一项

相关推荐
2023-11-14
webclient模板变量
过于重视行为规则、拘泥形式,往往在事业上错失良机。——培根 今天分享在使用webclient进行开发时的的一个小技巧 例如这个方法: 1org.springframework.web.reactive.function.client.DefaultWebClient.DefaultRequestBodyUriSpec#uri(java.lang.String, java.lang.Object...) 此处如果直接使用: 1webClient.get().uri("/dev/v1/kicking-rule?appid={}", appId) 或者 1webClient.get().uri("/dev/v1/kicking-rule?appid=%s", appId) 哪怕 1webClient.get().uri("/dev/v1/kicking-rule?appid=%s", appId) 都是不行的。。。 正确的方式应该是: 1webClient.get().uri("/de...
2020-06-16
拦截器解决跨域问题
大家平时在项目开发中遇到跨域问题是怎么解决的呢? 我相信有很多小伙伴就会回答:在Controller加上@CrossOrigin就可以啦! 但我们知道,在企业开发中,会有很多个controller,controller数量多也便于维护和查找控制层代码 那有没有一种方式能解决这种繁琐的问题呢?答案是肯定的! 下面介绍如何用JSONP解决跨域问题,哦不是用拦截器解决hh 12345678910111213141516171819202122232425262728293031323334353637package com.ruben.controller.interceptor;import org.springframework.http.HttpStatus;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.servlet.HandlerInterceptor;import org.springframework.web.servlet.Model...
2022-10-09
回收站拦截器
阿谀奉承者的喉咙是一座敞开的坟墓——佚名 基于mybatis-plus的租户拦截器TenantLineInnerInterceptor复制过来拓展 kotlin代码如下: 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721...
2022-12-16
获取泛型map工具类
一个人如果抛弃他忠实的朋友,就等于抛弃他最珍贵的声明。——索福克勒斯 代码如下: 1234567891011121314151617181920212223242526public static Map<String, Type> getGenericMap(Type paramType) { Type type = resolveType(paramType); if (type instanceof ParameterizedTypeImpl) { ParameterizedTypeImpl ty = (ParameterizedTypeImpl) type; final Class<?> rawType = ty.getRawType(); return Steam.of(rawType.getTypeParameters()).map(Type::getTypeName) .zip(Steam.of(ty.getActualTypeArgum...
2023-11-04
spring-state-machine守卫
是非之声,无翼而飞;损益之名,无胫而走。——白居易 文档: https://docs.spring.io/spring-statemachine/docs/current/reference/#configuring-guards 说白了守卫是用来判断事件执行后能否更新到下一个状态的 这里按之前提到的代码示例来示范 首先是配置为返回true,发现下面一路正常打印 然后是return false 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485package com.ruben.parent;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configura...
2023-06-16
pac4j
对付邪恶的特效药,就是跟邪恶战斗。——泰戈尔 分享一个java安全框架 https://www.pac4j.org/

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