Test Objects 以下為測試的資料物件,可以從中取得一個空List與有兩筆資料的List: public class TestBean { public List < TestSubBean > getEmptyList ( ) { return new ArrayList <> ( ) ; } public List < TestSubBean > getTestList ( ) { List < TestSubBean > list = new ArrayList <> ( ) ; list. add ( new TestSubBean ( "testSubBean1" ) ) ; list. add ( new TestSubBean ( "testSubBean2" ) ) ; return list ; } } public class TestSubBean { private String name ; public TestSubBean ( String name ) { this . name = name ; } public String getName ( ) { return name ; } } Template 樣本的部分,有資料顯示使用#,無資料顯示使用^: list: {{#testList}} name= {{name}} {{/testList}} emptylist: {{^emptyList}}empty list{{/emptyList}} Output list: name= testSubBean1 name= testSubBean2 emptylist: empty list