Liferay Portlet modes

What is Portlet mode?

Portlet modes are used to indicate what functions are they are doing currently. The portlet modes are defined in portlet.xml file.

  • Java Portlets supports  3 portlet modes :
    • view
    • edit
    • help
  • Liferay added additional 6 portlet modes in class com.liferay.portal.kernel.portlet.LiferayPortletMode.
    • about
    • config
    • edit_defaults
    • edit_guest
    • preview
    • print

Portlet modes are defined in portlet.xml file and below is sample config:
<portlet>
<portlet-name>employee-portlet</portlet-name>
<display-name>employee</display-name>
<portlet-class>org.javasavvy.controller.EmployePortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
</supports>
</portlet>

• portlet-name :  The portlet-name element contains the canonical name of the portlet. Each portlet name
is unique within the portlet application (that is, within the portlet plugin). This is also referred within Liferay Portal as the portlet (p_p_id)
• display-name :  The display-name type contains a short name that is intended to be displayed by tools. It is used by display-name elements. The display name need not be unique.
• portlet-class:  The portlet-class element contains the fully qualified class name that will handle invocations to the portlet.
• init-param:The init-param element contains a name/value pair as an initialization parameter of the portlet.

• expiration-cache:  Expiration-cache defines expiration-based caching for this portlet. The parameter
indicates the time in seconds after which the portlet output expires. -1 indicates that the  output never expires.
• supports: The supports element contains the supported mime-type. Supports also indicates the portlet modes a portlet supports for a specific content type.
• portlet-info:Portlet-info defines portlet information.

• security-role-ref: The security-role-ref element contains the declaration of a security role reference in the code of the web application

1 Comment

  1. Anjali

    Wonderful Post..!

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *