Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chingovan/f58b2c4b38be94f3e4cb9f2b88451d0e to your computer and use it in GitHub Desktop.
Save chingovan/f58b2c4b38be94f3e4cb9f2b88451d0e to your computer and use it in GitHub Desktop.
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
super.processAction(portletConfig, actionRequest, actionResponse);
// Get current preference of portlet
String portletResource = ParamUtil.getString(actionRequest, "portletResource");
PortletPreferences preferences = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);
// Get value of parameter(s)
String greeting = ParamUtil.getString(actionRequest, "greeting");
// Add parameter's value into preference
preferences.setValue("greeting", greeting);
// Store
preferences.store();
// Send successful message
SessionMessages.add(actionRequest, "success");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment