2013-05-15 5 views
0

안녕하세요 저는 StringTemplate 버전 3.2.1 및 Java를 사용하고 있습니다.stringTemplate에서 표현식이 작동하지 않습니다.

Stringtemplate에 ArrayList를 전달하지만이를 가져 오지 않습니다. 값의 수에 따라 배열을 반복하고 싶습니다.

ArrayList<Integer> test = new ArrayList<Integer>(); 

test.add(12334435); 
test.add(12334436); 
... 
StringTemplate sysProperties = new StringTemplateGroup("group","locationOfTemplate").getInstanceOf("templateName"); 
sysProperties.setAttribute("system", "test"); 

sysProperties.setAttribute("n", test); 

(그러나이 전달 된 ArrayList를 무시하는 것 (이 작동합니다). 그래서 배열 값의 수에 따라, 내가 동적으로 구축 할 XML) 파일에

StringTemplate :

<data> 
$if(test)$ 
$test:{ n | 
<value> 
<string>$n$</string> 
</value>}$ 
$endif$ 
</data> 

어떤 도움 위스콘신 이것은 크게 감사 할 것입니다. 미리 감사드립니다.

답변

0

당신이

$test:{ **n|**<-- You should use 'it' attribute to iterate - "The iterated it atribute is 
set automatically" 

source

ST3에 ST4 구문을 사용하는 것