简体   繁体   中英

Liferay - portlet title reloading

I have trouble with portlet title. My portlet is created in struts framework. Portlet titles are set by Liferay UI manager (so the settings are stored in hsql script I guess, right?).

  1. I choose language option;
  2. After some action I expect to change portlet title depend on language version but it doesn't work; The changes are visible after reloading the page one more time;

I have tried to implement StrutsPortlet class and set title dynammically (renderResponse.setTitle) like this Liferay: Set title name for view pages It also doesn't work. The changes are visible after reloading page one more time. Why the changes are not visible immediately? I have read ( http://colab.mpdl.mpg.de/mediawiki/images/3/38/PortletsinAction_Final.pdf ) that " The setTitle method is defined only in the RenderResponse interface; you can only change the portlet title in the render request-processing phase ". What it mean? Any suggest?

You should use resource bundle for localization of portlet title.

portlet.xml

    <portlet>
    <portlet-name>test-portlet</portlet-name>
    ...
            <resource-bundle>content.test-portlet</resource-bundle>
            ...
</portlet>

test-portlet.properties

javax.portlet.title=Test Portlet

test-portlet_sk.properties

javax.portlet.title=Testovaci Portlet

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM