freemarker嵌入文件输出结果

来源:互联网 发布:蚕丝毛毯 知乎 编辑:程序博客网 时间:2024/05/29 16:28

freemarker嵌入文件输出结果


1、嵌入的文件代码

inc.ftl:

<#assign username="李思思">

2、父文件代码

inner.ftl:

<html>  <head>    <meta http-equiv="content-type" content="text/html; charset=UTF-8">    <title>freemarker</title>  </head>    <body>     <#--freemarker-->     <#include "/inc/inc.ftl"/>     ${username}  </body></html>

3、测试方法

@Testpublic void testInner(){studentPrint("inner.ftl");}

4、测试结果

<html>  <head>    <meta http-equiv="content-type" content="text/html; charset=UTF-8">    <title>freemarker</title>  </head>    <body>          李思思  </body></html>


1 0
原创粉丝点击