Default objects of liferay


There are some default objects in jsp page we are using in liferay apart from the actual default objects of liferay. But unfortunately we don't know how many default objects providing by liferay.
After little investigation I came to know all the default objects which are providing by liferay.

There are two taglibs which we are including every time when we create portlet.

1.     <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />

The above statements will give 14 default objects :

actionRequest, actionResponse, eventRequest, eventResponse, portletConfig, portletName, portletPreferences, portletPreferencesValues, portletSession, portletSessionScope, renderRequest, renderResponse, resourceRequest, resourceResponse

and the type of each object as follows :

javax.portlet.ActionRequest actionRequest ;

javax.portlet.ActionResponse actionResponse ;

javax.portlet.EventRequest eventRequest ;

javax.portlet.EventResponse eventResponse ;

javax.portlet.PortletConfig portletConfig ;

java.lang.String portletName ;

javax.portlet.PortletPreferences portletPreferences ;

java.util.Map portletPreferencesValues ;

javax.portlet.PortletSession portletSession ;

java.util.Map portletSessionScope ;

javax.portlet.RenderRequest renderRequest ;

javax.portlet.RenderResponse renderResponse ;

javax.portlet.ResourceRequest resourceRequest ;

javax.portlet.ResourceResponse resourceResponse ;

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

The above statements will give 18 default objects :

themeDisplay, company, account, user, realUser, contact, layout, layouts, plid, layoutTypePortlet, scopeGroupId, permissionChecker, locale, timeZone, theme, colorScheme, portletDisplay, portletGroupId

and the type of each object as follows :

com.liferay.portal.theme.ThemeDisplay themeDisplay ;

com.liferay.portal.model.Company company ;

com.liferay.portal.model.Account account ;

com.liferay.portal.model.User user ;

com.liferay.portal.model.User realUser ;

com.liferay.portal.model.Contact contact ;

com.liferay.portal.model.Layout layout ;

java.util.List layouts ;

java.lang.Long plid ;

com.liferay.portal.model.LayoutTypePortlet layoutTypePortlet ;

java.lang.Long scopeGroupId ;

com.liferay.portal.security.permission.PermissionChecker permissionChecker ;

java.util.Locale locale ;

java.util.TimeZone timeZone ;

com.liferay.portal.model.Theme theme ;

com.liferay.portal.model.ColorScheme colorScheme ;

com.liferay.portal.theme.PortletDisplay portletDisplay ;

java.lang.Long portletGroupId ;

We can get these defaults objects using pageContext object which is default of the plain jsp. Below statement is the example for getting default objects.

ActionRequest actionRequest = (ActionRequest) pageContext.findAttribute(“actionRequest”);




Liferay 6 theme variables.

These are the  default Liferay 6 theme variables defined in init.vm.  I was searching but did not get any link ,so I hope this will help lot of people also around  the globe. If anything goes  wrong, pls make a comment and also try to add something that will help people around us.

## ———- Common variables ———- ##
$theme_display
$portlet_display
$theme_timestamp
$theme_settings
$css_class
$layout
$page_group
$liferay_toggle_controls
$liferay_dockbar_pinned
$css_folder
$images_folder
$javascript_folder
$templates_folder
$full_css_path
$full_templates_path
$css_main_file
$js_main_file
$company_id
$company_name
$company_logo
$company_logo_height
$company_logo_width
$company_url
$user_id
$is_default_user
$user_first_name
$user_middle_name
$user_last_name
$user_name
$is_male
$is_female
$user_birthday
$user_email_address
$language_id
$w3c_language_id
$time_zone
$user_greeting
$user_comments
$user_login_ip
$user_last_login_ip
$is_signed_in
$group_id
## ———- URLs ———- ##
$show_add_content
$add_content_text
$add_content_url
$layout_text
$layout_url
$show_control_panel
$control_panel_text
$control_panel_url
$show_home
$home_text
$home_url
$show_my_account
$my_account_text
$my_account_url
$show_page_settings
$page_settings_text
$page_settings_url
$show_sign_in
$sign_in_text
$sign_in_url
$show_sign_out
$sign_out_text
$sign_out_url
$show_toggle_controls
$toggle_controls_text
$toggle_controls_url
$update_available_url
## ———- Page ———- ##
$the_title
$selectable
$is_maximized
$is_freeform
$page_javascript_1
$page_javascript_2
$page_javascript_3
$layout
$page = $layout
$is_first_child
$is_first_parent
$the_title
$is_portlet_page
$all_portlets
$column_1_portlets
$column_2_portlets
$column_3_portlets
$column_4_portlets
$column_5_portlets
$maximized_portlet_id
$typeSettingsProperties
$page_javascript_1
$page_javascript_2
$page_javascript_3
$community_name
$css_class
$my_places_portlet_url
$community_default_public_url
$community_default_private_url
$community_default_url
$the_title
$layouts
$pages
## ———- Navigation ———- ##
$nav_items
$has_navigation
## ———- Staging ———- ##
$show_staging
$staging_text
## ———- My places ———- ##
$show_my_places
$my_places_text
## ———- Includes ———- ##
$dir_include
$bottom_include
$bottom_ext_include
$content_include
$top_head_include
$top_messages_include
## ———- Date ———- ##
$date
$current_time
$the_year

Comments