Thursday, June 12, 2014

Add a Success confirmation message in Liferay!

some times we need to display a custom success and error message on the portal after the user action.

so, we can do it like this:

In your java code add this:

SessionMessages.add(actionRequest, "successfully-handled-some-action");
  SessionErrors.add(actionRequest, "problem-occurred");

and add a section in jsp for picking this

 <liferay-ui:success key="successfully-handled-some-action" message="localization-key-for-this-message"/>
  <liferay-ui:error key="problem-occurred" message="localization-key-for-this-message"/>

And make the custom message entry for :

localization-key-for-this-message
in your language. properties fil:

For redirection after message, we can use:
actionResponse.setPortletMode(PortletMode.VIEW)

No comments:

Post a Comment