2016-05-12 68 views
0

我在做什么错?我无法获取要在Liferay动态数据列表portlet中显示的值。以下是模板代码。目前头后没有任何内容显示。但是,我在呈现的HTML中看到关闭表标记。动态数据列表未列出数据 - Velocity Liferay

#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> 
+0

你看到任何'tr'被生成?如果没有,我认为你的'$记录'是空的或没有填充。 –

回答

0

您的$records为空或者它未被添加到速度上下文中。您可以将其添加到上下文使用:

VelocityContext context = new VelocityContext(); 

context.put("records", your_records_list);