天天看點

struts 結果類型FreeMarker編寫模闆編寫配置檔案

FreeMarker

一個模闆引擎 即 FreeMarker

github

https://github.com/apache/freemarker

網址

https://freemarker.apache.org/

maven安裝

通路網址

https://search.maven.org/artifact/org.freemarker/freemarker/2.3.28/jar
<dependency>
  <groupId>org.freemarker</groupId>
  <artifactId>freemarker</artifactId>
  <version>2.3.28</version>
</dependency>           

編寫模闆

<!DOCTYPE html>
<html lang="zh_CN">
<head>

</head>
<body>
    hello world ${name}
</body>
</html>           

編寫配置檔案

<result name="success" type="freemarker">
                <param name="location">/hello.fm</param>
            </result>