Tag Archives: Liferay

Play With Structure/Template In Liferay

Hi All, When we are creating a structure for a webcontent with some name, then some time we require to get structureId of that structure programmatically. Below is the sample code for that: private String getStructureId() { String STRUCTUREID = null; try { DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(JournalStructure.class, PortalClassLoaderUtil.getClassLoader()).add(PropertyFactoryUtil. forName(“name”).like(“%YOUR_STRUCTURE_NAME_HERE%”)); List structures = JournalStructureLocalServiceUtil.dynamicQuery(dynamicQuery, 0, 1); […]


Liferay: How to Setup Liferay 6.2 EE Developer Environment

Installing Liferey Developer Studio Navigate to https://www.liferay.com/get-ee-trial/downloads/developer-studio. In the Downloads section, select ‘Windows 64 Bit Bundle’ and click on download. Create a folder on your machine where you want to setup your liferay environment. I have C:\work\liferay\ Unzip the downloaded file into the folder you created for liferay development. Open Liferay Developer Studio by clicking […]


How to use the resource phase of a portlet ?

Usually when we have to make an AJAX call or when the user should download a file  from a portlet we use the “Resource Phase” of a portlet.


How to hide Liferay default error message

When a server-side error occur in Liferay, a default message could be shown to the user : This message is displayed when an exception is not planned to be thrown in the current JSP.



// <!–[CDATA[ Liferay.namespace('HubSSO'); Liferay.provide(Liferay.HubSSO, 'openHub', function(url) { var A = AUI(); A.io.request(url, { cache: 'false', dataType: 'json', on: { success: function() { var data = this.get('responseData'); openWindowLarge(data.url,'HUB'); } } } ); }, ['aui-io-request'] ); Liferay.provide(Liferay.HubSSO, 'openHubURL', function() { var currentURL = location.href + "?" + "p_p_id=HubSSOPortlet_WAR_HubSSOPortlet&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_resource_id=getURL"; Liferay.HubSSO.openHub(currentURL); } ); Liferay.provide(Liferay.HubSSO, 'getName', function() { var A […]


Custom Display, Review and Expiry date in Liferay

Recently we had a requirement where we want all our new articles to go live next day, up for review in 6 months and automatically expire in 1 year. Of course, all this can be overriden by content authors at the time of content creation. But these are the defaults we wanted. To achieve this […]