国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
freemarker(1)老紫竹的第一個freemaker程序 - freemarker ...
1 下載freemarker

  我用的是 配置過程2.3.13

  2 配置Build Path。

  解壓縮有,把lib里面的jar加入Eclipse的Build Path 里面

  3 創(chuàng)建測試程序

package freemarker;
  
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
import freemarker.template.Configuration;
import freemarker.template.Template;
  
public class Test1 {
 private Configuration cfg;
  
 public Configuration getCfg() {
  return cfg;
 }
  
 public void init() throws Exception {
  cfg = new Configuration();
  cfg.setDirectoryForTemplateLoading(new File("bin/freemaker"));
 }
  
 public static void main(String[] args) throws Exception {
  Test1 obj = new Test1();
  obj.init();
  Map root = new HashMap();
  Template t = obj.getCfg().getTemplate("Test1.ftl");
  Writer out = new OutputStreamWriter(new FileOutputStream("Test1.html"), "GBK");
  t.process(root, out);
  System.out.println("Successfull................");
 }
}

  4 使用到的模板

<#macro greet person,website>
 Hello ${person}! Your Website is ${website}.
</#macro>
<html>
<head>
 <title>Hello World</title>
</head>
<body>
<@greet person="老紫竹" website=">
</body>
</html>

  5 運行結(jié)果

<html>
<head>
 <title>Hello World</title>
</head>
<body>
 Hello 老紫竹! Your Website is <a target="_blank" href="
>
</body>
</html>

打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Java模板引擎 FreeMarker
java如何生成word文檔_使用Java生成word文檔(附源碼)
Spring發(fā)送郵件簡單實例
freemarker報 java.io.FileNotFoundException:及Te...
動態(tài)表單及動態(tài)建表實現(xiàn)原理
Java Web開發(fā)——FreeMarker模板使用方法講解
更多類似文章 >>
生活服務(wù)
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服