@Autowired
private FreemarkerConfigurer configurer;
public String markerResult(){
Map<String, Object> map = new HashMap<>();
Student stu = new Student();
map.put(stu);
Template template = configurer.getConfiguration.getTemplate("template.ftl");
String rs = FreemarkerTemplateUtils.processingTemplateToString(template, map);
}
<html>
//get value simple
${stu.name!''} //empty value change to ''
${(stu.createDate?string('dd-MM-yyyy hh:mm:aa'))!''}// java.util.Date format to 01-Feb-2019 02:03 AM hh十二小时制, aa是AM or PM.
//loop simple
<#list stu.bookList as book>
${book.name}
</list>
</html>