Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ed F.
Set portlet configuration programatically
December 16, 2008 2:09 PM
Answer

Ed F.

Rank: Expert

Posts: 280

Join Date: June 26, 2006

Recent Posts

Hello all, I've got this nice nifty new portlet that creates child pages with certain default templates, but I'm having problems trying to set one of the portlet's configurations. I would like LOVE to set a Wiki Display portlet to a particular node (programatically - from java), but I am completely stuck trying to figure out how. I have the layout object for the page, and the wiki node object available to me. Probably more.

In portlet/wiki_display/configuration.jsp:
1<form action="<liferay-portlet:actionURL portletConfiguration="true" />" method="post" name="<portlet:namespace />fm">
2<input name="<portlet:namespace /><%= Constants.CMD %>" type="hidden" value="<%= Constants.UPDATE %>" />

etc., etc. with the selection box autofilling with available node Id's.

Now, that form action is something I'm not familiar with. Where does that go?

If I could figure that out, I might be able to copy whatever it calls to set the configuration for that portlet.

Anyone have any ideas? Anyone ever worked with portlet configurations outside of the configuration menu?

Any help would be extremely appreciated.
Thanks!
Ed F.
RE: Set portlet configuration programatically
December 17, 2008 11:13 AM
Answer

Ed F.

Rank: Expert

Posts: 280

Join Date: June 26, 2006

Recent Posts

1   
2        prefs = PortletPreferencesFactoryUtil.getPortletSetup(
3                Layout layout, String portletId, String defaultPreferences);
4   
5        prefs.setValue("node-id", Long.toString(node.getNodeId()));
6        prefs.setValue("title", "");
7       
8        prefs.store();


Tada!