Liferay Portlet Objects For JSPs

You may have noticed the <liferay-portlet:defineObjects> tag in your JSPs. Similar to the theme:defineObjects tag, when you include this tag in your JSP, you gain access to several variables that, in this case, return useful information about your portlet. Note that the JSR-286 specification defines four lifecycle methods for a portlet: processAction, processEvent, render, and serveResource. Some of the variables defined by the <portlet:defineObjects/> tag are only available to a JSP if the JSP was included during the appropriate phase of the portlet lifecycle. These objects are described in the table below:

ObjectDescription
ActionRequest actionRequestRepresents the request sent to the portlet to handle an action. actionRequest is only available to a JSP if the JSP was included during the action-processing phase.
ActionResponse actionResponseRepresents the portlet response to an action request. actionResponse is only available to a JSP if the JSP was included in the action-processing phase.
EventRequest eventRequestRepresents the request sent to the portlet to handle an event. eventRequest is only available to a JSP if the JSP was included during the event-processing phase.
EventResponse eventResponseRepresents the portlet response to an event request. eventResponse is only available to a JSP if the JSP was included in the event-processing phase.
HeaderRequest headerRequestRepresents the request sent to the portlet to handle its HTML header or HEAD section. headerRequest is only available to a JSP if the JSP was included during the header-processing phase.
HeaderResponse headerResponseRepresents the portlet response to a header request. headerResponse is only available to a JSP if the JSP was included in the header-processing phase.
LiferayPortletRequest liferayPortletRequestProvides access to the HttpServletRequest, the Portlet, and the portlet name and lifecycle value. liferayPortletRequest is available in all portlet phases.
LiferayPortletResponse liferayPortletResponseIncludes the properties returned to the portal and provides a means to add or change properties. liferayPortletResponse is available in all portlet phases.
RenderRequest renderRequestRepresents the request sent to the portlet to render the portlet. renderRequest is only available to a JSP if the JSP was included during the render request phase.
RenderResponse renderResponseRepresents an object that assists the portlet in sending a response to the portal. renderResponse is only available to a JSP if the JSP was included during the render request phase.
ResourceRequest resourceRequestRepresents the request sent to the portlet for rendering resources. resourceRequest is only available to a JSP if the JSP was included during the resource-serving phase.
ResourceResponse resourceResponseRepresents an object that assists the portlet in rendering a resource. resourceResponse is only available to a JSP if the JSP was included in the resource-serving phase.
PortletConfig portletConfigRepresents the portlet’s configuration including, the portlet’s name, initialization parameters, resource bundle, and application context. portletConfig is always available to a portlet JSP, regardless of the request-processing phase in which it was included.
PortletPreferences portletPreferencesProvides access to a portlet’s preferences. portletPreferences is always available to a portlet JSP, regardless of the request-processing phase in which it was included.
Map<String, String[]> portletPreferencesValuesProvides a Map equivalent to the portletPreferences.getMap() call or an empty Map if no portlet preferences exist.
PortletSession portletSessionProvides a way to identify a user across more than one request and to store transient information about a user. A portletSession is created for each user client. portletSession is always available to a portlet JSP, regardless of the request-processing phase in which it was included. portletSession is null if no session exists.
Map<String, Object> portletSessionScopeProvides a Map equivalent to the PortletSession.getAtrributeMap() call or an empty Map if no session attributes exist.

For more details, visit the Portlet 3.0 API Javadoc.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy