Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Set title of the page for view pages in liferay

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.87k
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: