Calling service classes in from webcontent


Follwing URL gives what are the variables can be access in the CMS template.


  1. http://www.liferay.com/community/wiki/-/wiki/Main/CMS+Internal+API
  2. http://www.liferay.com/es/community/wiki/-/wiki/Main/Access+Objects+from+Velocity
  3. http://www.liferay.com/web/raymond.auge/blog/-/blogs/custom-velocity-tools-and-liferay-6-0
  4. If we see the $request output, it gives manythings.

Some it requires to access the services from the custom portlet . We need to add property in portal-ext.properties

If we find the "journal.template.velocity.restricted.variables" it contains key value as serviceLocator. Whenever we are adding the property in a file we need to remove the "serviceLocator" form below  and add it as below.

    #
    # Input a comma delimited list of variables which are restricted from the
    # context in Velocity based Journal templates.
    #
    journal.template.velocity.restricted.variables=

After restarting the server we can access the services like  $serviceLocator.findService(-----)

#set ($userLocalService= $serviceLocator.findService("com.liferay.portal.service.UserLocalService"))
#set ($user = $userLocalService.getUserById($request.get("theme-display").get("user-id")))
#set ($emailAddress = $user.getEmailAddress())



Comments

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate