Get portlet preferences


I experience problems to get the portlet preferences.
I define a portlet preference in portlet.xml


I try to get preferences in the PortletListener of my application, in the handleRenderRequest method :


But the preferences list is empty.
Is it not the good way ?


Although I did not test this, it looks correct (to the spec) to me.

If it does not work, I would suspect some portal specific issues are involved. Which portal and version are you using?


I tried this out and seems to be working fine for me. I added a similar XML fragment to the portlet.xml and used the following code to retrieve the defined value in the handleRenderRequest method.

request.getPreferences().getValue("test", "empty")

I was using Vaadin 6.2.3 and Liferay Portal 5.2.3.

Hi Guillaume,

If you are using Liferay Portal, the preferences-unique-per-layout and preferences-owned-by-group are set to true by default. This means that you have different values of portlet preferences for each liferay layout or portal page.

So if you added your portlet to a portal page before you defined the portlet preferences, the preferences are empty for that portlet in that specific page. Try removing your portlet from the page and add it again or add the portlet in another page.