0
votes

I'm using Liferay 6.1 with Struts2 and trying to get portlet preferences in the action class. My project includes 3 portlets and they all use the same action class. The class implements PortletPreferencesAware interface and overrides the setPortletPreferences() method. My question is, as all three portlets in the project have different preferences, which portlet's preferences will be returned? I don't seem to be able to get the values I want using preferences.getValue() in the action class.

Note, I can get the preferences in the JSP so I know they are set up correctly

Thanks

1

1 Answers

1
votes

I'd expect preferences to be stored depending on the portlet that is invoked, not on the implementation class. So even if you share the implementation between 3 portlets, each will have its own set of preferences by default.

Typically the application's state will be passed into the implementation through request/response objects and its attributes and you'll have to go from there - or, preferably, through the API. Just don't expect the 3 portlets to share the same preferences out of the box, just because they share the same implementation.