Why not just hard-code the value in your Java source?
I want admin to be able to modify it from the portlet itself, but not to influence only his preferences, but also the default preferences.
look at the Management Portlet and how it does this ?
you will find thing that you can reuse for what you want to do in the Edit mode of your portlet...
look also at the concept of Dynamicity, in the wiki and forum (and the web, as I quit remember Roy Russo has written things on this).
it is what allow the administrator to modify the portal configuration dinamically...
The configuration of a portlet is stored in the database of jbp, so the default preference are there to.
It is were you must change them for what you want to do.
The Management Portlet isn't written by jboss, so I can't get a look at
I've seen the preferences in the database, but I want to change them
programmaticaly -- how can I access them from the code?
I think I could do it by getting the reference to the current instance and then by calling getPreferences() I would have had access to management of these preferences (I'm also not sure whether it would affect only current user or the default preferences).
But I am experiencing a problem -- I get the reference to the InstanceContainer, but when I try to call getInstance(..), a Hibernate exception saying 'unable to locate current JTA transaction' is thrown.
What could I do (I've got no idea about Hibernate).
It's opensource - all stuff you get in portal you can get from CVS. Nothing is hidden ;)
For transaction error - you need to set in your jboss-portlet.xml
<portlet> <portlet-name>PortletName</portlet-name> <transaction> <trans-attribute>Required</trans-attribute> </transaction> </portlet>
or cover your code with transaction context by your self
Thanks, that does it.
Everything else worked just as I wanted, so the problem is solved.