2012-06-14 2 views

답변

4

, 이것은 당신이해야 할 더 이하 :

// factory and an engine instance 
VelocityEngineFactory velocityEngineFactory = new VelocityEngineFactory(); 
VelocityEngine engine = velocityEngineFactory.createVelocityEngine(); 
// now you need to give the variables you wanna have access from velocity script 
VelocityContext context = new VelocityContext(properties); 

ByteArrayOutputStream temp = new ByteArrayOutputStream(); 
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(temp)); 
// generate the result, where scriptString is the velocity script 
engine.evaluate(context, bufferedWriter, null, scriptString); 
bufferedWriter.flush(); 
textResultant = temp.toString(); 

그래서 스크립트를 만들고로드하여 프로그래밍 방식으로 처리 할 수 ​​있습니다.

관련 문제