Hello Guys
I here to set title of the view page in liferay. We can also set the title of the portlets.
We have many ways to set page title of the liferay page because liferay provide dynamic functionality.
You can add page title by using PortalUtil as below :
It sets the title of the web page , not the title of the liferay portlet.
PortalUtil.addPageTitle (String myTitle, HttpServletRequest request);
There are two approcahes to solve this :
Liferay provides an option to set the title of the web page via portlet preferences.
PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, instanceId);
Locale locale = new Locale("en", "US"); //straight to the point
portletSetup.setValue("portlet-setup-title-" + LocaleUtil.toLanguageId(locale), title);
portletSetup.setValue("portlet-setup-use-custom-title", "true");
portletSetup.store();
In your portlet controller class, you can set the title of web page to the response.
response.setTitle("Dynamic Title");
You can also add unique title per page using the control panel.
0 Comment(s)