I had a similar problem. The problem with preferences is that they are
per user. They are therefore not suitable for portlet configuration
because configuration should be the same for all users. I eventually
solved it in the following way:
I use commons-configuration from apache which allows you to save
properties to a properties file. I use RenderResponse.getNamespace() to
get a name that is unique per portlet instance. As far as I know this is
the only way you can get a portlet instance specific identifier for your
portlet instance. This + .properties becomes the filename for the
portlet properties file so each instance has its own persistent
properties store. I use an init param to specify the location for the
properties files. The first time the portlets are displayed, they create
their own properties file if one doesn't exist. I adjust the properties
in the edit mode of the portlet and the processAction saves the changes
to the properties file.
Unfortunately the problem of configuration is not solved very well in
jsr168. JSR168 specifies that you can use the same portlet multiple
times but doesn't specify a way to identify the instances. The namespace
trick described above is a hack. A major disadvantage is that jsr168
doesn't specifiy what the namespace should look like so you can't
configure the portlets upfront (because you don't know what the
namespace will be) and have to wait for the portlet to create the
properties file. An additional problem may be that the namespace string
is not suitable for use as a filename (not an issue in jetspeed).
Otherwise this works fine for me.What I would prefer is that each
portlet instance would be assigned a name by the portal and that each
instance has its own parameters. Of course this is how many portals
probably work but it is not part of JSR 168 so you can't take this
behaviour for granted.
Regards,
Jilles van Gurp
Scott T Weaver wrote:
You would probably be better off using portlet preferences as opposed to
init parameters.
Hth,
Scott
-----Original Message-----
From: Sebastian Komander [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 06, 2005 9:30 AM
To: [email protected]
Subject: One portlet on multiple pages but different parameters
Hi...
I want to create a portlet which shows articles. I want to place this
portlet on many pages. Then, i want to set a parameter which is different
for every page. Example:
Portlet is placed on page1, page2, page3, page4, page5. The parameter is
named "type".
Portlet on page1: type="a"
Portlet on page2: type="b"
Portlet on page3: type="c"
Portlet on page4: type="d"
Portlet on page5: type="e"
I want to do this without copying the portlet 5 times. Is this possible ?
The parameter should be saved in the portlet preferences or where ever it
is possible.
In WebSphere Portlet is this possible, does it work in Jetspeed2-M3 also ?
Can you tell me how this works ?
kind regards
Sebastian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]