Reputation: 99
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
Upvotes: 1
Views: 506
Reputation: 2151
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.
Upvotes: 2