Posts

Getting the modal hints for the column in class

We will update the maxlength for the column in portlet-modal-hints.xml. Just like as below <field name="comments" type="String"> <hint name="max-length">500</hint> </field> If we want to get these max length in the class,  we can use the below code. ModelHintsUtil.getMaxLength(model, field) model : Class name field : columnName ex: ModelHintsUtil.getMaxLength(KBUser.class.getName(), "comments");

Debug the Mail in liferay

To turn on logging of Liferay mail and JavaMail, add the following to your Log4j configuration in  webapps/ROOT/WEB-INF/class/ META-INF/portal-log4j-ext.xml  after the last  <appender>  entry: <logger name="com.liferay.util.mail"> <level value="DEBUG"/> </logger>

Analyzing the Portlet Performance in liferay

Set the following log in the  tomcat/lib/META-INF/portal-log4j-ext.xml <category name="com.liferay.portlet.InvokerPortletImpl">        <priority value="DEBUG" />     </category> This will cause the performance of each portlet render to be logged, for example:  render for welcomeportlet_WAR_welcomeportlet takes 1 ms render for employmentportlet_WAR_linksportlet takes 80 ms

Difference between System Exception and Portal Exception

SystemException  This  Exception caused by system problems. Examples include database connection errors and file not found errors.   System exceptions are always unexpected , and generally indicate that the   portal is misconfigured or that a critical service is unavailable. PortalException  This exceptions related to business logic. Examples include invalid input, portlet errors, and references to non existent database records.   Portal exceptions are generally caused by user error , and do not indicate that anything is wrong with the portal itself.

Creating the URL programmtically

Hi, Below is the code ,to create the different types of request URL. As we know in Liferay we have 3 types of URL 1.ActionRequest 2.RenderRequest 3.ResourceRequest. //Create Render URL PortletURL renderURL = PortletURLFactoryUtil.create( actionRequest,PortalUtil.getPortletId(actionRequest), themeDisplay.getLayout().getPlid(), "0"); renderURL.setParameter("customparam","customvalue"); actionResponse.sendRedirect(renderURL.toString()); If you want to create the ActionRequest put 1 instead of 0 in the last argument. We can check the code in the  PortletURLImpl class of liferay if (_lifecycle.equals(PortletRequest.ACTION_PHASE)) { _reservedParameters.put("p_p_lifecycle", "1"); } else if (_lifecycle.equals(PortletRequest.RENDER_PHASE)) {

Liferay Input Move boxes

Image
In Liferay we have one more taglib called input-moveboxes , where we can move the items from left to right viceversa. Which can be look like as below, Here the Code, <%@page import="com.liferay.portal.kernel.util.KeyValuePair"%> <%@page import="java.util.ArrayList"%> <%@page import="java.util.List"%> <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %> <portlet:defineObjects /> <% List<KeyValuePair> leftList = new ArrayList<KeyValuePair>(); leftList.add(new KeyValuePair("1", "Blog")); leftList.add(new KeyValuePair("2", "Asset Publisher")); leftList.add(new KeyValuePair("3", "Wiki")); leftList.add(new KeyValuePair("4", "Message Board")); leftList.add(new KeyValuePair("5", ...

Steps to follow to deploy/undeploy the EXT

As we know that EXT is not hot deployable , we need to restart the server whenever it is deployed. At first time we can deploy the EXT without any prob, but when we need to redeploy or undploying the EXT following things need to be followed. 1. Stop the tomcat server 2. Delete the temp and work folder of tomcat server. It will be reside in the <tomcat-home>. Probably it can as  liferay-portal-6.2.10.1-ee-ga1\tomcat-7.0.42\temp and  liferay-portal-6.2.10.1-ee-ga1\tomcat-7.0.42\work. 3. Make sure to delete the JAR files created when EXT is deployed. All the jar files will be created with name prefix as ext . Jar files will be at <tomcat-home>/lib/ext it can  liferay-portal-6.2.10.1-ee-ga1\tomcat-7.0.42\lib\ext.                 ext-*-ext-service.jar Also it can also be at <tomcat-home>/ROOT/WEB-INF/lib/ probably it can be as  liferay-portal-6.2.10.1-ee-ga1\tomcat-7.0.42\webapps\ROOT\WEB-...