Site icon Pro Liferay

Liferay Theme Define Objects

theme define objects


An use of single tag can provide you many predefined objects in your JSP. For liferay developer one most widely used tag is theme:defineObjects. It does not have any body and attributes.An use of this tag gives a certain numbers of ready to use objects in your JSP. This article explains the various objects provided by this tag. For liferay beginners this article can be a good reference. 


How to use this tag:  Your JSP should have only two lines of code.

<%@ taglib uri="http://liferay.com/tld/theme" prefix="theme" %>
<theme:defineObjects/>

Use of this tag provides the following ojects in your JSP

1. user

To get the current User object you can use this object.


2. timeZone

Java provides time zone. To get current user’s time zone we can use this object.


3. themeDisplay

A runtime object which contains many useful items such as the logged-in user, the layout, logo information, paths, and much more.


4. theme

This object represents the current theme that is being rendered by the portal.


5. scopeGroupId

By default this object contains the groupId for the community or organization in which the portlet resides. 


6. realUser

When an administrator is impersonate a user, this variable tracks the administrator’s User object.


7. portletDisplay

An object that gives the programmer access to many attributes of the current portlet including the portlet name, the portlet mode, the ID of the column on the layout in which it resides and more.


8. plid

Every page in liferay has unique ID.This is called portal layout ID. This is a unique identifier for any page that exists in the portal across all portal instances.


9. permissionChecker

An object that can determine-given a particular resource-whether the current user has a particular permission for that resource.


10. locale

The current user’s locale which is  defined by Java.


11. layoutTypePortlet

This object can be used programmatically to add or remove portlets from a page.


12. layout

The layout object represents the page to which the user has currently navigated.


13. contact

This is user’s Contact object. This object maps to the Contact table in the Liferay database.


14. company

The current Company object. This represents the portal instance on which the user is currently navigating.


15. colorScheme

An object representing the current color scheme in the theme that is being rendered by the portal.


16. account

The user’s Account object. This object maps to the Account table in the Liferay database.

Exit mobile version