Disable default error and sucess message in liferay portlet.
Follow the below step to disable default error and success message in liferay portlet:
Step 1: Add the below code in portlet.xml
<init-param>
<name>add-process-action-success-action</name>
<value>false</value>
</init-param>
Before
<expiration-cache>0</expiration-cache>
Step 2: Add the below code in portlet action method
PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
LiferayPortletConfig liferayPortletConfig = (LiferayPortletConfig) portletConfig;
SessionMessages.add(actionRequest, liferayPortletConfig.getPortletId() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
SessionMessages.add(actionRequest, liferayPortletConfig.getPortletId() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_SUCCESS_MESSAGE);
Step 1: Add the below code in portlet.xml
<init-param>
<name>add-process-action-success-action</name>
<value>false</value>
</init-param>
Before
<expiration-cache>0</expiration-cache>
Step 2: Add the below code in portlet action method
PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
LiferayPortletConfig liferayPortletConfig = (LiferayPortletConfig) portletConfig;
SessionMessages.add(actionRequest, liferayPortletConfig.getPortletId() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
SessionMessages.add(actionRequest, liferayPortletConfig.getPortletId() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_SUCCESS_MESSAGE);
Comments
Post a Comment