Error: java.lang.ClassNotFoundException: org.apache.jsp.html.portlet.dockbar.view_jsp

No Comments »

After restarting your Server you might get a:

ClassNotFoundException: org.apache.jsp.html.portlet.dockbar.view_jsp

This is a known issue in Liferay 6.2. The solution is quite simple.

Create a empty file view_user_account.portal.jspf in /webapps/ROOT/html/portlet/dockbar/.

Animated Loading Icon (Spinner / Progress Bar)

1 Comment »

I just tried to show an animated loading icon (like a spinner or progress bar) while my portlet was loading.

 A very simple way is to use the css-class "loading-animation", which is delivered with Alloy-Ui, I guess.

 Adding a single div:
<div class="loading-animation" />

 You will get an animated logo like this:


How to get and modify Portal-URL

2 Comments »

import com.liferay.portal.kernel.util.HttpUtil; 
import com.liferay.portal.kernel.util.ParamUtil; 
import com.liferay.portal.util.PortalUtil;
 
// delivers url-path including parameters
String currentUrlPathWithParamters = PortalUtil.getCurrentURL( request );
// --> Example: /group/guest/home?foo=test

// delivers url-path without parameters
String currentUrlPath = HttpUtil.getPath(currentUrlPathWithParamters);
// --> Example: /group/guest/home

// delivers complete url
String currentUrl = PortalUtil.getPortalURL( request ) + currentUrlPath;
// --> Example: http://localhost:8080/group/guest/home

// adding parameters to url
String urlWithCustomParameter= HttpUtil.addParameter(currentUrl,"foo", "faa");
// --> Example: http://localhost:8080/group/guest/home?foo=faa

portal-setup-wizard

No Comments »

After starting a clean liferay instance, you will see the portal-setup-wizard helping you to configure your portal. It provides help concerning your database-connection, default user,...

After you finished configuration portal-setup-wizard will not show up again. To enable portal-setup-wizard again, you can set the following property inside portal-setup-wizard.properties:

portal.setup.wizard.enabled=true

Hook- vs Ext-plugin

No Comments »

Using Hooks you can:

  • provide a portal configuration (portal-ext.properties)
  • define new or modify existing language key (language.properties)
  • modify portal JSPs
  • define servlet filters
  • implement post indexers
  • override Liferay-Services (especially by implementing a ServiceWrapper, like for example UserServiceWrapper)


Using an ext-Plugin it is possible to:

  • override any class inside Liferay (classes inside portal-iml.jar or portal-util)
  • modify Liferay's core portlet's desciptors and configurations (like portelt.xml, liferay-portlet.xml,...)

Ext-plugins are more powerful than hook-plugins BUT ext-plugins are not hot-deployable, an can not be undeployed! If you want to undeploy an ext-plugin, it is recommended to start with a clean liferay instance!

Get PortletPreferences

No Comments »

import javax.portlet.PortletPreferences;
import com.liferay.portlet.PortletPreferencesFactoryUtil;

PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup( layout , portletId); 
String foo = portletSetup.getValue("foo", "defaultValue");

Get all portlets placed on a page (layout)

No Comments »

To get all portlets placed on a page (layout) you can use the following lines of code:

import com.liferay.portal.model.LayoutTypePortlet;
import com.liferay.portal.model.Portlet;

LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) l.getLayoutType();
List< Portlet > portlets = layoutTypePortlet.getAllPortlets();