Java ��� TemplateLibrary. FreeMarker ��� ������ ������������ ������ ��� ������그������������ ������ ������.
Very Simple Example ¶
~cpp // SpikeVelocity.java import java.io.OutputStreamWriter; import java.io.Writer; import java.util.Properties; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; public class SpikeVelocity { public static void main(String[] args) throws Exception { Properties prop = new Properties(); // Velocity ����� ������ ������ : properties ������ ������. prop.setProperty("input.encoding" ,"euc-kr"); prop.setProperty("output.encoding" ,"euc-kr"); Velocity.init(prop); // properties ������(velocity.properties) ��� ��������� ������ ������. // ������ ��������� ������������ ��������� ������ VelocityContext con = new VelocityContext(); con.put("data1", "��������� ���������"); // ��������� ������ ������. Template tmpl = Velocity.getTemplate("./tmpl/simple.vm"); // ������ ������ : System.out ��� ���������. Writer out = new OutputStreamWriter(System.out); tmpl.merge(con, out); out.flush(); } }
simple.vm ������ - template.
~cpp #set ($name = "hahaha") $name:$name$name ����� ���������. $data1
Plugin ¶
Veloeclipse - http://propsorter.sourceforge.net/veloeclipse/
DreamWeaver Plugin - http://java.techedu.net/phpBB2/viewtopic.php?t=138 - ������.. ������ ������ ������ ��������������� ������게 ��� 감������������. .png)
.png)
������ ������ : Velocity ��������� ������ ¶
Velocity ������ ��������� ��� ��������� ��������� 각 ������ ��� ��������������� ��������� ������!!!
~cpp #set ($prevNo = $pageNo - 1) (O) #set ($prevNo=$pageNo-1) (X)