File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Portals and Portlets and the fly likes Settings for portlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Settings for portlet" Watch "Settings for portlet" New topic

Settings for portlet

Roberto Campione

Joined: Nov 13, 2008
Posts: 1
Hi All,

I'm relatively new with portal and portlets so I'll explain this as best I can.

I have a portlet, say a View portlet, that changes it's view based on a user setting. There could be numerous View portlets, each with their own setting - i.e. one would show a list of 10, the other a list of 20 etc.

The user sets the number of list items.

Question: How do I store this value to be unique to a individual portlet? So if I set a value on View portlet A, I don't want it to be set of View portlet B.

I've tried a number of options:

- PortletPreferences
- PortletSession
- PortletContext

but none of them suit my needs.

Anybody got any ideas?
srinivas bodapati

Joined: Jul 09, 2008
Posts: 14
If you want the user to enter his settings and want the portlet to modify its view based on these seetings, then the best option would be to use the configure/personalize/edit mode of the portlet, which you set while creating the portlet or can add from the portlet.xml file.

The other option would be to have a portlet preference set and make copies of your portlet as many as you want and set the value of this preference for each portlet.
Thus each portlet has its own setting and displays its own view.

Perception Matters.
Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
Using PortletPreference!

Implement doEdit, using PortletPreference, remember to call "store" method on your portletPreference.

[ December 17, 2008: Message edited by: damu liu ]
I agree. Here's the link:
subject: Settings for portlet
It's not a secret anymore!