Ejemplo n.º 1
0
  public static void main(String[] args) throws IOException, TemplateException {
    Configuration cfg =
        FreeMarkerUtil.getFolderCfg(
            "D:/workspace/eopnew/eop/WebContent/WEB-INF/classes/com/enation/javashop/core/widget/goodscat");
    Template temp = cfg.getTemplate("GoodsCat.html");
    ByteOutputStream stream = new ByteOutputStream();

    Writer out = new OutputStreamWriter(stream, "UTF-8");
    temp.process(new HashMap(), out);

    out.flush();
    String html = stream.toString();
    System.out.println(html);
  }
Ejemplo n.º 2
0
  public static void test() {
    Configuration cfg;
    try {
      cfg =
          FreeMarkerUtil.getFolderCfg(
              "D:/workspace/eopnew/eop/WebContent/WEB-INF/classes/com/enation/javashop/core/widget/goodscat");
      Template temp = cfg.getTemplate("GoodsCat.html");
      ByteOutputStream stream = new ByteOutputStream();

      Writer out = new OutputStreamWriter(stream, "UTF-8");
      temp.process(new HashMap(), out);

      out.flush();
      String html = stream.toString();
      System.out.println("+++++++++" + html);
    } catch (IOException e) {
      e.printStackTrace();
    } catch (TemplateException e) {
      e.printStackTrace();
    }
  }