/** * Process an action request. * * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, * javax.portlet.ActionResponse) */ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException { if (request.getParameter(FORM_SUBMIT) != null) { // Set form text in the session bean Vlado2PortletSessionBean sessionBean = getSessionBean(request); if (sessionBean != null) sessionBean.setFormText(request.getParameter(FORM_TEXT)); } if (request.getParameter(EDIT_SUBMIT) != null) { PortletPreferences prefs = request.getPreferences(); try { prefs.setValue(EDIT_KEY, request.getParameter(EDIT_TEXT)); prefs.store(); } catch (ReadOnlyException roe) { } catch (ValidatorException ve) { } } if (request.getParameter(CONFIG_SUBMIT) != null) { PortletPreferences prefs = request.getPreferences(); try { prefs.setValue(CONFIG_KEY, request.getParameter(CONFIG_TEXT)); prefs.store(); } catch (ReadOnlyException roe) { } catch (ValidatorException ve) { } } }
/* ACTION call from Portlet's <form> of EDIT JSP */ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { String saveSettingsGoogleMapsUtility = actionRequest.getParameter("saveSettingsGoogleMapsUtility"); /*You can add other getParameter of EDIT JSP*/ if (saveSettingsGoogleMapsUtility != null) { PortletPreferences prefs = actionRequest.getPreferences(); if (actionRequest.getParameter("inTypeUtility") != null) prefs.setValue("typeUtility", actionRequest.getParameter("inTypeUtility")); if (actionRequest.getParameter("inStreetView") != null) prefs.setValue("chkStreetView", actionRequest.getParameter("inStreetView")); if (actionRequest.getParameter("inZoom") != null) prefs.setValue("chkZoom", actionRequest.getParameter("inZoom")); if (actionRequest.getParameter("inDraggable") != null) prefs.setValue("chkDraggable", actionRequest.getParameter("inDraggable")); if (actionRequest.getParameter("inPanControl") != null) prefs.setValue("chkPanControl", actionRequest.getParameter("inPanControl")); if (actionRequest.getParameter("inRotateControl") != null) prefs.setValue("chkRotateControl", actionRequest.getParameter("inRotateControl")); if (actionRequest.getParameter("inScaleControl") != null) prefs.setValue("chkScaleControl", actionRequest.getParameter("inScaleControl")); if (actionRequest.getParameter("inTypeMap") != null) prefs.setValue("typeMap", actionRequest.getParameter("inTypeMap")); if (actionRequest.getParameter("inAddress") != null) prefs.setValue("address", actionRequest.getParameter("inAddress")); if (actionRequest.getParameter("inDescriptionMarker") != null) prefs.setValue("descriptionMarker", actionRequest.getParameter("inDescriptionMarker")); if (actionRequest.getParameter("inTypeIcon") != null) prefs.setValue("typeIcon", actionRequest.getParameter("inTypeIcon")); if (actionRequest.getParameter("inFromAddress") != null) prefs.setValue("fromAddress", actionRequest.getParameter("inFromAddress")); if (actionRequest.getParameter("inToAddress") != null) prefs.setValue("toAddress", actionRequest.getParameter("inToAddress")); prefs.store(); actionResponse.setPortletMode(PortletMode.VIEW); } }