3
我正在从数据库中提取对象列表。我想使用velocity模板将它们填充到html表格中。在html模板中显示速度模板中的java对象列表
<table>
<thead>
<tr>
<td>$value1 </td>
<td>$value2 </td>
</tr>
</thead>
<tbody>
<!-- Iterate through the list (List<SomeObject>) and display them here, -->
</tbody>
</table>
对于我使用下面的代码头,
VelocityContext context = new VelocityContext();
context.put("value1", "text1");
context.put("value2", "text2");
我从对象如下获取数据,
List<SomeObject> obj = new ArrayList<SomeObject>();
obj.getItem1();
obj.getItem2();
所有单个项目的字符串。如何填充表体内容?