2016-05-12 36 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);