Total Pageviews

Saturday, August 11, 2012

Using Custom portlet services in Theme Template

Service builders and velocity template are two very important parts of Liferay, and I personally feel joy working with velocity. Today, I am going to write one more article on Velocity templates, which is about the usage of custom portlet services in theme velocity templates. I've already written an article about usage of Liferay services in theme templates (see article). Calling custom portlet services which we build using the service builder is a bit different, however we need to call the same findService method which is overloaded in ServiceLocator class. All difference is we need to pass the servlet context name along with the service class name, as under
The servlet context name is the name of folder of your portlet inside the web-app folder, and if you have doubt, you can use following code to get servlet context name.
One caution, you should have the portlet deployed in the server, whose service you are going to use in theme, otherwise this will give you "Bean Locator is null" exception on server logs.

Hope this will help.

No comments:

Post a Comment