Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Dharmender Singh
Changing Liferay Portlet preferences programatically
July 14, 2010 12:40 AM
Answer

Dharmender Singh

Rank: New Member

Posts: 3

Join Date: April 22, 2010

Recent Posts

Hello All,

I am trying to change the portlet preferences of (NEIS) which is my custom portlet of type IFrame, Using the following code...

// Code
javax.portlet.PortletPreferences NEISUIprefs1 = PortletPreferencesLocalServiceUtil.getDefaultPreferences(0, "NEISUI");
NEISUIprefs1.setValue("src", "http://www.google.com");

// update the portlet preferences
PortletPreferencesLocalServiceUtil.updatePreferences(0, 0, 0, "NEISUI", NEISUIprefs1);


The issue that i am facing is that, sometimes the preferences are changed and sometimes it does not change the preferences.

Kindly suggest the solutioin for changing the portlet preferences programatically....

Thanks in advance...
Dharmender Singh
Suhail Ahmed
RE: Changing Liferay Portlet preferences programatically
July 14, 2010 3:59 AM
Answer

Suhail Ahmed

Rank: Regular Member

Posts: 126

Join Date: January 1, 2008

Recent Posts

Hi Dharmender,


you can save like this
NEISUIprefs1.store();
, instead of this


// update the portlet preferences
PortletPreferencesLocalServiceUtil.updatePreferences(0, 0, 0, "NEISUI", NEISUIprefs1);





Hope this will helpful


Thanks

Suhail Ahmed