简体   繁体   中英

Liferay velocity Webcontent template - $JournalArticleLocalService

In my Liferay 6.2 EE Velocity Webcontent template i declared the themeDisplay object as follows:

#set ($themeDisplay = $request.theme-display)

I also adapted my portal-ext.properties:

velocity.engine.restricted.classes=
velocity.engine.restricted.variables=

Now i want to invoke the following method call:

#set ($articleId = $cross_selling.getData())
      #set ($result = $JournalArticleLocalService.getArticleDisplay($groupId, $articleId, $viewMode, $themeDisplay.getLanguageId(), $themeDisplay))
            $result

but the unexpected output is the following:

$result

What is the best way within Velocity to make a method call to $JournalArticleLocalService ?

Thanks

If you have not set $JournalArticleLocalService you should do that first as follows. You can then use all the methods available to JournalArticleLocalService.

#set ($JournalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))

You should also do a null check for the article ID before attempting to use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM