E D R , A S I H C RSS

Velocity

Java �� TemplateLibrary. FreeMarker ���������� ���� �� ����그�������� �� ��.

JakartaStruts - VelocityTools ������ �� ����.


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


DreamWeaver Plugin - http://java.techedu.net/phpBB2/viewtopic.php?t=138 - �.. �� ���� �� �������� ����게 �� 감������. :)

StrutsAndVelocityIntegration


���� ���� : Velocity ������ ����

Velocity ���� ������ ���� ������ 각 ���� �� �������� ����!!!
~cpp 
#set ($prevNo = $pageNo - 1)  (O)
#set ($prevNo=$pageNo-1)  (X)
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:21
Processing time 0.0268 sec