2014-12-23 88 views
1

我正在嘗試在Liferay中的期刊文章的velocity模板中使用serviceLocator。Liferay,在Journal article velocity模板中使用serviceLocator

journal.template.velocity.restricted.variables= 

然後我重新啓動服務器

在我的虛擬機文件我有:

#set ($countryService = $serviceLocator.findService("com.liferay.portal.service.CountryService")) 
#set ($countryList = $countryService.getCountries()) 
#foreach ($country in $countryList) 
    $country.getName() 
#end 

這在文章中顯示任何 我加入行修改portal-ext.properties文件並且在服務器上也沒有錯誤。我也檢查了數據庫和國家在那裏,如果我在我的portlets服務中使用getCountries()方法,它會返回國家,因爲它應該。

有沒有人有類似的問題?

回答

2

我弄清楚我做錯了什麼。 在portal-ext.properties首先我設置:

journal.template.velocity.restricted.variables= 

而是說,它sholud是:

velocity.engine.restricted.variables=