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/.
Error: java.lang.ClassNotFoundException: org.apache.jsp.html.portlet.dockbar.view_jsp
Animated Loading Icon (Spinner / Progress Bar)
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
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
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
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)
- 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,...)
Get PortletPreferences
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)
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();