掲示板
Accessing Custom Liferay Services in Velocity Templates
13年前 に Aswin Giridhar によって更新されました。
Accessing Custom Liferay Services in Velocity Templates
New Member 投稿: 15 参加年月日: 11/02/09 最新の投稿
Hey Guys,
I have created a plugin portlet which contains custom liferay services and I am trying to access the services from a velocity template in themes.
I added my service jar into the global server directory (lib/ext).
I am able to access my services through another portlet plugin, but am not able to access my services through the velocity templates since I am getting a BeanLocatorException.
I even set this property on portal-ext.properties : "journal.template.velocity.restricted.variables=".
Any help would be appreciated.
Thanks,
I have created a plugin portlet which contains custom liferay services and I am trying to access the services from a velocity template in themes.
I added my service jar into the global server directory (lib/ext).
I am able to access my services through another portlet plugin, but am not able to access my services through the velocity templates since I am getting a BeanLocatorException.
I even set this property on portal-ext.properties : "journal.template.velocity.restricted.variables=".
Any help would be appreciated.
Thanks,
13年前 に Jitendra Rajput によって更新されました。
RE: Accessing Custom Liferay Services in Velocity Templates
Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
have a look in below link..
http://btnkumar.blogspot.in/2011/11/how-to-access-custom-portlet-services.html
http://btnkumar.blogspot.in/2011/11/how-to-access-custom-portlet-services.html
13年前 に Aswin Giridhar によって更新されました。
RE: Accessing Custom Liferay Services in Velocity Templates
New Member 投稿: 15 参加年月日: 11/02/09 最新の投稿
Thank you. I found out that we need to provide the portlet Id in the serviceLocator.findService.
13年前 に Jitendra Rajput によって更新されました。
RE: Accessing Custom Liferay Services in Velocity Templates
Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
Now are you able to access your services inside Vm or nt ?
13年前 に Aswin Giridhar によって更新されました。
RE: Accessing Custom Liferay Services in Velocity Templates
New Member 投稿: 15 参加年月日: 11/02/09 最新の投稿Jitendra Rajput:
Now are you able to access your services inside Vm or nt ?
Yes, I am able to access my custom service.
#set ($customLocalService = $serviceLocator.findService('CustomAdmin-portlet', 'com.test.service.CustomLocalService'))
11年前 に nasir hussain によって更新されました。
RE: Accessing Custom Liferay Services in Velocity Templates
New Member 投稿: 18 参加年月日: 10/04/26 最新の投稿
BTW, there is no need to copy the jar into the tomcat/lib/ext folder
Only,
and the call in the journal template can be made like
Only,
journal.template.velocity.restricted.variables=should be in portal-ext.properties
and the call in the journal template can be made like
#set ($myLocalService = $serviceLocator.findService("test-portlet", "com.test.MyLocalService"))
$myLocalService .getTestCount()
9年前 に Kalai Arasan によって更新されました。
RE: Accessing Custom Liferay Services in Velocity Templates
Regular Member 投稿: 127 参加年月日: 13/01/02 最新の投稿
Hi
I added the line
journal.template.velocity.restricted.variables=
at portal-ext.properties and tried to access the java class from vm file like as
#set ($myLocalService = $serviceLocator.findService("test-portlet", "com.test.MyLocalService"))
$myLocalService .getTestCount()
But I am getting the exception like
com.liferay.portal.kernel.bean.BeanLocatorException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '"com.test.MyLocalServicel' is defined
Can you please tell me what is wrong with that.
I added the line
journal.template.velocity.restricted.variables=
at portal-ext.properties and tried to access the java class from vm file like as
#set ($myLocalService = $serviceLocator.findService("test-portlet", "com.test.MyLocalService"))
$myLocalService .getTestCount()
But I am getting the exception like
com.liferay.portal.kernel.bean.BeanLocatorException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '"com.test.MyLocalServicel' is defined
Can you please tell me what is wrong with that.