⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helloworld.java

📁 Turbine示例
💻 JAVA
字号:
import java.io.StringWriter;import org.apache.velocity.app.VelocityEngine;import org.apache.velocity.Template;import org.apache.velocity.VelocityContext;/** *  Simple program to demonstrate the basic  *  technique of rendering a Velocity template */public class HelloWorld{    public static void main( String[] args )        throws Exception    {        /*         *  first, get and initialize a Velocity engine         */        VelocityEngine ve = new VelocityEngine();        ve.init();        /*         *  next, get the Template           */        Template t = ve.getTemplate( "helloworld.vm" );        /*         *  create a context and add data           */        VelocityContext context = new VelocityContext();        context.put("name", "World");        /*          *  now render the template into a StringWriter          */        StringWriter writer = new StringWriter();        t.merge( context, writer );        /*          *  show the world          */        System.out.println( writer.toString() );         }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -