num=string.count(str))[n] 参数说明: str: 表示为分隔符,默认为空格,但是不能为空('')。
${goodsList?size} 1. 转换字符串为 JSON 对象 <#assign text="{'bank':'工商银行','account':'10101920201920212'}" /> <#assign data=text?eval /> 1. 2. 3. 日期格式化 当前日期:${today?date} 当前时间:${today?time} 当前日期+时间:${today?datetime} 日期格式化: ${today?string("yyyy 年 ...
转至:http://zhuyuehua.iteye.com/blog/1975251 freemarker list (长度,遍历,下标,嵌套,排序) 1. freemarker获取list的size : Java ArrayList<String> list = new ArrayList<String>(); Freemaker ${list?size} 2. list的遍历: <#list animals as being> being.namebeing.name{being.price} </#list>...
public static void main(String[] args) { String templateFileLoaderPath = "D:/fm"; String templateLoaderPath = "/fl"; String templateName = "freemaker1.ftl"; Configuration cfg = new Configuration(); String htmlPath = "D:/WEB-INF/view"; String htmlName = "test2.html"; User user = ...
trim} 替换指定字符串 ${stringxx}---${stringxx?replace("s","ggg")} 5.5 字符串空值情况处理 5.6 sequence 类型 5.7 hash类型 代码语言:javascript 代码运行次数:0 运行 AI代码解释 hashmap key遍历输出: <#list hashmap?keys as key> <#-- starts 是list,star 是遍历出来的每一个元素 --> $...
迭代map11Map<String,Object> userMap =newHashMap<String,Object>();12userMap.put("address","wuhan");13userMap.put("birthday","11月01");14userMap.put("phone",null);1516//3.迭代常规对象17model.addAttribute("flag",1);18model.addAttribute("home","wuhan");1920//list、map添加进model21...
split("|") as item>split:${item}</#list>trim:2.处理数字的内建函数:string:x?string("0.##") --> 转换为保留两位小数点-四舍五入round:四舍五入floor:去掉小数点ceiling:进一<#assign num=3.1415926/>${num?string("0.##")}${num?round}${num?floor}${num?ceiling}3.处理List的内建...
输出流template.process(params,newFileWriter("d:/list.html"));}privateMapgetData(){Map<String,Obje...
${foo?string("yes","no")} <#-- yes --> 大小比较符号使用需要注意:(xml的原因),可以用于比较数字和日期 使用lt、lte、gt和gte来替代<、<=、>和>= 也可以使用括号<#if (x>y)> 内置函数: 调用区别于属性的访问,使用?代替. 常见的一些内置函数 ...
Type="String">姓名</Data></Cell><Cell><Data ss:Type="String">年龄</Data></Cell><Cell><Data ss:Type="String">电话</Data></Cell><Cell><Data ss:Type="String">住址</Data></Cell></Row><#list resultList as item><Row><Cell><Data ss:Type="String">${item.name!''}</Data></...