0

我究竟做错了什么?我无法获得要在 Liferay 动态数据列表 portlet 中显示的值。以下是模板代码。目前,标题后没有显示任何内容。但是,我在呈现的 HTML 中看到了结束表标记。

#set ($ddlRecordService = $serviceLocator.findService('com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService'))
#set ($recordSetId = $getterUtil.getLong($reserved_record_set_id.data))
#set ($records = $ddlRecordService.getRecords($recordSetId))

<table class="table table-striped">
<caption>Audio files listing of FDR speeches</caption>
<thead>
   <tr>
        <th>Date</th>
        <th>Description</th>
        <th>Tape information</th>
    </tr>
  </thead>
 <tbody>
 #foreach($record in $records) 

        #set ($audioDate = $record.getField("audioDate").getValue())
        #set ($audioDesc = $record.getField("audioDesc").getValue())
        #set ($audioLink = $record.getField("audioLink").getValue())
     <tr>
        <td>$audioDate</td>
        <td>$audioDesc</td>
        <td>$audioLink</td>
    </tr>
  #end
</tbody>
</table>
4

1 回答 1

0

你的要么$records是空的,要么没有添加到速度上下文中。您可以使用以下方法将其添加到上下文中:

VelocityContext context = new VelocityContext();

context.put("records", your_records_list);
于 2016-05-13T09:17:32.577 回答