Freemarker does not assign staticUtil

不羁岁月 提交于 2019-12-04 04:13:42

The properties you refer to have been moved to an OSGI config in Liferay 7/DXP. To deploy them you need to create a file named com.liferay.portal.template.freemarker.configuration.FreeMarkerEngineConfiguration.cfg and place it under $LIFERAY_HOME/osgi/configs

The content of the file will be the following:

restrictedVariables=

To find all the configs and their defaults you can have a look at the class com.liferay.portal.template.freemarker.configuration.FreeMarkerEngineConfiguration

That you can find in the Liferay source code.

I think those properties in portal-ext.properties are just ignored in liferay 7.

You can admin those properties in Control Panel → Configuration → System Settings → Foundation → FreeMarker Engine and remove "staticUtil" (or remove "serviceLocator" directly) from restricted variables. (liferay reboot is required)

Onno van der Zee

In liferay 7.1. you will find Freemaker Engine under

Control Panel -> System Settings -> Platform -> Template Engines

  • Go to Control Panel -> System Settings -> Foundation Page

  • Find FreeMarker Engine from list click on it .

  • Remove serviceLocator variable and staticUtil from restricted variables by Clicking on (-) icon.

  • If you want to use staticUtil object then also remove this variable from restricted variables.

  • Save it.

  • Restart Liferay server.

You will direct access to serviceLocator object in your Application Display Template.

In liferay-ce-portal-7.1.1.2-ga3 version, the file is renamed to

com.liferay.portal.template.freemarker.configuration.FreeMarkerEngineConfiguration.config
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!