Reputation: 1438
I want to add a confirmation message and a redirect to my jsp when the form is validated.
I saw this in liferay's source code
SessionMessages.add(actionRequest, config.getPortletName() + ".doConfigure");
This displays a green styled message with Param has been saved successfully
. But doesn't work. It obviously uses Configuration menu (which opens a pop-up), and I use Preferences menu, still can I adapt this line for my code?
And when I change preferences, I want a redirect in my portlet, but for now, it is still on the preferences page and I have to click on Return to full page
.
Also, can I display error messages in the case the preferences aren't validated?
Regards. Thank you
Upvotes: 1
Views: 2139
Reputation: 48067
For every
SessionMessages.add(actionRequest, "successfully-handled-some-action");
SessionErrors.add(actionRequest, "problem-occurred");
you will need a section picking it up in your jsp (otherwise nobody would know where you'd like it to appear on the page):
<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"/>
Upvotes: 5