【问题标题】:Liferay, using serviceLocator in Journal article velocity templateLiferay,在期刊文章速度模板中使用 serviceLocator
【发布时间】:2015-02-21 14:24:17
【问题描述】:

我正在尝试在 Liferay 期刊文章的速度模板中使用 serviceLocator。 我通过添加以下行修改了 portal-ext.properties 文件:

journal.template.velocity.restricted.variables=

然后我重新启动了服务器

在我的 vm 文件中,我有:

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

这不会在文章中显示任何内容,也不会在服务器上显示错误。我还检查了数据库和国家/地区,如果我在我的 portlet 服务中使用 getCountries() 方法,它会返回应有的国家/地区。

有人遇到过类似的问题吗?

【问题讨论】:

    标签: liferay velocity


    【解决方案1】:

    我发现我做错了什么。 在 portal-ext.properties 中,我首先设置:

    journal.template.velocity.restricted.variables=
    

    但是,应该是:

    velocity.engine.restricted.variables=
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-22
      • 2017-04-05
      • 1970-01-01
      • 1970-01-01
      • 2013-01-18
      • 1970-01-01
      • 2014-09-01
      • 2019-08-11
      相关资源
      最近更新 更多