Package freemarker.template

Examples of freemarker.template.Template.process()


                final PrintWriter writer = response.getWriter();

                final StringWriter stringWriter = new StringWriter();

                template.setOutputEncoding("UTF-8");
                template.process(getDataModel(), stringWriter);

                final String pageContent = stringWriter.toString();

                writer.write(pageContent);
                writer.flush();
View Full Code Here


     
      /* write */
      Writer out = response.getWriter();
     
      /* freemaker call */
      template.process(model.getAll(), out);
    }
    catch (IOException e)
    {
      log.severe(ftlPath+" 해당 파일을 찾을 수 없습니다.");
    }
View Full Code Here

   {
      Writer output = new StringWriter();
      try
      {
         Template templateFile = freemarkerConfig.getTemplate(templateLocation);
         templateFile.process(map, output);
         output.flush();
      }
      catch (IOException ioEx)
      {
         throw new RuntimeException(ioEx);
View Full Code Here

          root.put("tag", tag);

          // save file
          BufferedWriter writer = new BufferedWriter(new FileWriter(new File(rootDir, tag.getName() + ".html")));
          try {
            template.process(root, writer);
          } finally {
            writer.close();
          }
        }
      }
View Full Code Here

            // Give subclasses a chance to hook into preprocessing
            if (preTemplateProcess(request, response, template, model)) {
                try {
                    // Process the template
                    template.process(model, response.getWriter());
                } finally {
                    // Give subclasses a chance to hook into postprocessing
                    postTemplateProcess(request, response, template, model);
                }
            }
View Full Code Here

  public static String sql(String groupNameAndsqlId,Map<String,Object>paras){
    try{
      StringReader reader=new StringReader(sqlMap.get(groupNameAndsqlId));
      Template temp=new Template("", reader);
      StringWriter out=new StringWriter();
      temp.process(paras, out);
      return out.toString();
    }catch(Exception e){}
    return "";
  }
View Full Code Here

                //BodyPart subjectPart = new MimeBodyPart();
                Template subjectTextTemplate = configuration.getTemplate(subjectTemplatePrefix);
                final StringWriter subjectTextWriter = new StringWriter();
               
                try {
                  subjectTextTemplate.process(map, subjectTextWriter);
                } catch (TemplateException e) {
                    throw new MailPreparationException("Can't generate Subject Text", e);
                }        
                mimeMessage.setSubject(subjectTextWriter.toString());     
               
View Full Code Here

                Template bodyTextTemplate = configuration.getTemplate(bodyTemplatePrefix);
                final StringWriter bodyTextWriter = new StringWriter();
               
               
                try {
                  bodyTextTemplate.process(map, bodyTextWriter);
                } catch (TemplateException e) {
                    throw new MailPreparationException("Can't generate Body Text", e);
                }
                mimeMessage.setText(bodyTextWriter.toString());
               
View Full Code Here

     // freemark
        StringWriter writer = new StringWriter();
        Configuration configuration = new Configuration();
        configuration.setTemplateLoader(new ClassTemplateLoader(PerformanceTest.class, "/"));
        Template template = configuration.getTemplate("books.ftl");
        template.process(context, writer);
//        byte[] ret = null;
        long start = System.currentTimeMillis();
        for (int i = 0; i < times; i++) {
          writer = new StringWriter();
          template.process(context, writer);
View Full Code Here

        template.process(context, writer);
//        byte[] ret = null;
        long start = System.currentTimeMillis();
        for (int i = 0; i < times; i++) {
          writer = new StringWriter();
          template.process(context, writer);
          writer.toString().getBytes("UTF-8");
    }
        long end = System.currentTimeMillis();
        System.out.println("freemark: " + (end - start) + "ms\t" + (int)(times / (double)(end - start) * 1000) + "tps");
//        System.out.println(new String(ret, "UTF-8"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.