RE: MVCPortlet, SessionMessages and Redirect

thumbnail
Gennaro Lippiello, modified 3 Years ago. Junior Member Posts: 39 Join Date: 3/9/22 Recent Posts

Hello, in my custom MVCPortlet I have a view.jsp file with inside a form which calls a function in my portlet.java file.
After the function, if everything is ok I'm calling the method "SessionMessages.add(actionRequest,"success");" in order to show a custom success message.

Everything works fine, but after the success message I need to redirect the user on another page. So I thought to add a simple redirect "actionResponse.sendRedirect(themeDisplay.getURLPortal());" after the method that shows the custom message. But in this way the redirect is too fast and I have no time to read the success message.

Which is the best way to show the custom success messagge, give to user enought time to read it, and then redirect the page?
It would be great if I can show the succes message in a popup, and only when the user close the popup he will be redirected. Is this possible?

Jamie Sammons, modified 11 Months ago. New Member Posts: 24 Join Date: 6/13/23 Recent Posts

In this case, Use your success message in redirected page. i.e

<liferay-ui:success key="success" message="Greeting saved successfully!" /> in your redirected page. So, you can see the message in redirected page.