Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Doubts about redirection
Hi,
I am making a portlet, with a combo for selecting fields, and then it has to redirect to another page and show another jsp different. Is it possible?
For instance, I have the portlet in /home, which shows view.jsp, and when a button is pressed, I want that the portlet redirects to /newPage and then shows the newpage.jsp
I try with actionResponse.sendRedirect but I am not able to find a way to specify which jsp shows. Is there any option of select what jsp has to be shown in doView method?
Any ideas would be very appreciated
Thanks in advance
Hi,
You can form a URL by using PortletURLFactory and redirect to specific page and jsp, You can refer below example
Layout layout = LayoutLocalServiceUtil.fetchLayoutByFriendlyURL(groupId, privateLayout, "/newPage ");
PortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, "yourportletid", layout,PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/newpage.jsp");
actionResponse.sendRedirect(portletURL.toString());
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™