こんにちは仲間Liferay'ers、私はFreemarkerのテンプレートを使用してjournalArticleのカテゴリを取得しようとしているLiferay 7 Freemarkerテンプレート。 JournalArticleのカテゴリー
を取得しようとしました - staticUtilはNULLまたは行方不明に評価しています。
私はこのコードを試してみました:
<#assign journalArticleId = .vars['reserved-article-id'].data>
<#assign journalArticleResourceLocalServiceUtil = staticUtil["com.liferay.portlet.journal.service.JournalArticleResourceLocalServiceUtil"]>
<#assign assetCategoryLocalServiceUtil = staticUtil["com.liferay.portlet.asset.service.AssetCategoryLocalServiceUtil"]>
<#assign articleResourcePK = journalArticleResourceLocalServiceUtil.getArticleResourcePrimKey(groupId, journalArticleId)/>
<#assign categoryList=assetCategoryLocalServiceUtil.getCategories("com.liferay.portlet.journal.model.JournalArticle",articleResourcePK) >
<#list categoryList as categoryList>
${categoryList.getName()}
</#list>
私もportal-setup-wizzard.properties
freemarker.engine.restricted.classes=
freemarker.engine.restricted.variables=
freemarker.engine.restricted.packages=
にこのラインを追加しました私は、コードを実行すると、それは、このエラーがスローされます。
08:26:30,582 ERROR [http-nio-8080-exec-10][runtime:60] Error executing FreeMarker template
FreeMarker template error:
The following has evaluated to null or missing:
==> staticUtil [in template "20202#20246#41671" at line 14, column 51]
----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign journalArticleResourceLocalSe... [in template "20202#20246#41671" at line 14, column 1]
----
Java stack trace (for programmers):
----
は誰もい私はここで間違っているアイデアを持っていますか?前もって感謝します。 configurazionは、コントロールパネルで
Control Panel -> Configuration -> System Settings
-> Foundation -> FreeMarker Engine -> Restricted Variables
である彼らはFreeMarkerのエンジンの設定を変更する必要がありLiferayを7で