Posts

How to read and write properties files in liferay

Liferay developer sometimes need to read and write properties files. 1.     For golobal configurations one can put properties valuse on portal.properties     You can acheive this by overwrite portal.properties using Liferay Hook.     As below:      <?xml version="1.0"?>     <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">     <hook>         <portal-properties>portal.properties</portal-properties>     </hook>     and then write your requird key values in this file.     Below sample key values:      default.landing.page.path=/web/guest/home     company.default.home.url=/web/guest/home         To read golobal portal properties file you can use liferay com.liferay...

Disable default error and sucess message in liferay portlet.

Follow the below step to disable default error and success message in liferay portlet: Step 1: Add the below code in portlet.xml <init-param>             <name>add-process-action-success-action</name>             <value>false</value> </init-param> Before <expiration-cache>0</expiration-cache> Step 2: Add the below code in portlet action method PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);             LiferayPortletConfig liferayPortletConfig = (LiferayPortletConfig) portletConfig;             SessionMessages.add(actionRequest, liferayPortletConfig.getPortletId() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);            ...

Custom Login Portet In Liferay.

Sometimes liferay developer needs create custom login/signin protlet for their requirement. Here share my experience how one can create  custom login portlet in liferay. Dowload the portlet form github Step 1: jsp file >>> Replace the view.jsp file with the below code. <%-- /** * tariqliferay.blogspot.com */ --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %> <%@ taglib uri="http://liferay.com/tld/ddm" prefix="liferay-ddm" %> <%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %> <%@ taglib uri="http://liferay.com/tld/security" prefix="liferay-security" %> <%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay...

How to add portlet in liferay theme.

Some times liferay developer need to embed or add portlet in theme. To do this follow the below process: Add the below code in portal_normal.vm file.. ## Set the portlet id #set ($locPortletId = "signup_WAR_signupportlet") #set ($portletPreferencesFactoryUtil = $portal.getClass().forName("com.liferay.portlet.PortletPreferencesFactoryUtil")) #set ($portletSetup = $portletPreferencesFactoryUtil.getLayoutPortletSetup($layout, $locPortletId))   #if ($portletSetup.getValue("portletSetupShowBorders", "") != "false")     #set ($temp = $portletSetup.setValue("portletSetupShowBorders", "false"))     #set ($temp = $portletSetup.store()) #end #set ($embeddedPortletURL = $portletURLFactory.create($request, $locPortletId, $layout.plid, "RENDER_PHASE")) ## Make sure it's in popup mode, otherwise it doesn't embed nicely. #set ($VOID = $embeddedPortletURL.setWindowState("pop_up")) #set...

Liferay Builds with the ECJ Compiler(Tricks for linux).

Task cannot continue because ECJ is not installed. ECJ was automatically installed. Please rerun your task. I suffer for above issue. Finally resolve this in ubuntu. I don't use Eclipse IDE environment, Ubuntu provides ecj compiler separately: Step 1: sudo apt-get install ecj Step 2: If you using ant of Ubuntu (sudo apt-get install ant) You need to link ecj.jar to its directory(If ecj.jar already in /usr/share/ant/lib/ecj.jar then first remove this): sudo ln -s /usr/share/java/ecj.jar /usr/share/ant/lib/ecj.jar   Enjoy...

How to disable aui.css css in your theme in liferay 6.2.

Many liferay developer want to use bootstrap 3 for his/her theme but liferay 6.2 not support bootstrap 3. In liferay boostrap css integrate in aui.css. So need disable aui.css and add bootstrap 3 css. There are two ways to disable aui.css: 1.In your theme _diffs folder add aui.css and remove all content. 2. Using liferay Hook( This should not follow because disable important liferay feature. ): In liferay theme all necessary css and js are include in portal_normal.vm as below.. <head>     $theme.include($top_head_include) </head>  Above $top_head_include is vm variable which value is defined in html>common>themes>top_head.jsp. You can override this using hook... create a Hook plugin project and comment below line.. <%-- Portal CSS --%> <%-- <link class="lfr-css-file" href="<%= HtmlUtil.escapeAttribute(PortalUtil.getStaticResourceURL(request, themeDisplay.getPathThemeCss() + "/aui.css")) %>" rel=...

How to disable password reset on first login in liferay.

Image
To disable password reset follow the below step. 1.Change portal settings: Go to control panel>Password policies>default password policies and false change required check box. Change Required 2.Change portal.properties in custom hook: Create a hook and below properties. <?xml version="1.0"?> <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd"> <hook>     <portal-properties>portal.properties</portal-properties> </hook> And add below properties. passwords.default.policy.change.required=false # For password reset false users.reminder.queries.enabled=false #For remainder queries users.reminder.queries.custom.question.enabled=false #For custom questions login.create.account.allow.custom.password=true #For custom password terms.of.use.required=false #For agree terms of use 3.In java code update user: user.setPasswordRese...