-
1. Re: how to set Preferences
bsmithjj Sep 14, 2005 11:19 AM (in response to sandeeppujar)You can use the PortletPreferences.store() method directly. Behind the scenes, JBoss Portal will save your user preferences (values) in table jbp_user_pref_prop_value (if you want to check with your DB GUI tool).
In your portlet you should:
1. obtain a reference to PortletPreferences:PortletPreferences portletPrefs = portletRequest.getPreferences();
2. update the desired values of the preferences:
portletPrefs.setValue(...) or portletPrefs.setValues(...)
3. Invoke portletPrefs.store(). -
2. Re: how to set Preferences
sandeeppujar Sep 14, 2005 6:28 PM (in response to sandeeppujar)Thanks ,
I have another question,
If I have a guest user , then how do I save his preferences ?
I have it setup and use portletPrefs.store(), but nothing appears in the database, is there any configuration I am missing.
Below is my code
PortletPreferences pref = request.getPreferences();
pref.setValues(team + PREF_METRIC_LIST, metricsArray);
pref.setValue(team + PREF_ACTIVE_METRIC_LIST, "yes");
pref.store();
Thanks for all the inputs,
Sandeep -
3. Re: how to set Preferences
julien1 Sep 14, 2005 6:51 PM (in response to sandeeppujar)could you give a good primary key for a guest user ? if so I can persist it in a database.
-
4. Re: how to set Preferences
sandeeppujar Sep 14, 2005 7:14 PM (in response to sandeeppujar)The primary key can be "guest" .
I guess PortletPreferences class assumes that there is a current user who
has logged in.
For guest this might not work as guest need not log in but still I might want to store some preferences for him.
Is there a way I can set the user to guest by default and store the preferences for guest ?
thanks,
Sandeep