Package org.apache.velocity.app

Examples of org.apache.velocity.app.VelocityEngine.mergeTemplate()


      VelocityEngine ve = new VelocityEngine();
      ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
      ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
     
      ve.mergeTemplate(
        "screenshare.vm"
        , "UTF-8"
        , ctx
        , response.getWriter());
    } catch (Exception er) {
View Full Code Here


          x = parsePath.substring(startSub, endSub);
          if(x.equals("0") || x.startsWith("0_")){
            Logger.debug(this, "Method WebAPI.canParseContent : The content being parsed is 0 : returning false");
            return false;
          }
      ve.mergeTemplate(parsePath, "UTF-8", ctx, w);
    } catch (Exception e) {
      Logger.debug(this.getClass(), "Velocity Error: " + e);
      Logger.debug(this,e.getMessage(),e);
      return false;
    }
View Full Code Here

        VelocityContext ctx = new VelocityContext();
        ctx.put("foo", "bar");

        StringWriter writer = new StringWriter();
        VelocityEngine engine = VelocityUtil.createEngine();
        engine.mergeTemplate("velocity/test.tmpl", "UTF-8", ctx, writer);

        assertTrue(writer.toString().trim().equals("Hello bar."));
    }
}
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.