Total Pageviews

Tuesday, May 22, 2012

Getting User Image


Following are two code snippets which can be used for getting user image:

and
Hope this will help.

Monday, May 21, 2012

Liferay Cache - ehcache


Liferay internally uses EhCache for implementing cache for the database. However it is possible to implement ehcache in our custom code.
You can see the additional knowledge about it here.
But this how the liferay caches the database it is using. Apart form this, we can also use ehcache for our custom implementation. Lets see how this can be done:
Here we have two function setting and getting values in cache. We can import the class and use in our code.
Hope this will help.

Sunday, May 13, 2012

Parsing Web Content in Java


Template based web content is one of the most promising feature of Liferay and I personally found it very helpful for various requirements.
Creating Structure based template is quite easy, see this link.


Once the web content is created, there are various ways to display it. The easiest way is to put a web content display portlet on the page and select the web content to display in it. But there are cases in which we need to get field's data inside Java code. This makes web contents more usable in live scanerios like you have to render selected content of all template based web contents.


The following code will help you about this.
Once a web content is created, a content is created, but once it is modified another one is vreated, so need to get the latest versions of all the articles, following code will help you. 
Please help yourself with proper imports. Hope this will help you.