It is posible for a portlet to read a request parameter of its surrounding page?
E.g. the URL of the page the portlet resides in is http://example.com/mypage?foo=bar Is it possible to read the "foo" parameter from a portlet that is on that page?
Portlet Container is Liferay 5.2.5.
Yes this can be achieved with something like this -
HttpServletRequest convertReq = PortalUtil.getHttpServletRequest(request);
HttpServletRequest originalReq = PortalUtil.getOriginalServletRequest(convertReq);
String productId = originalReq.getParameter("foo");
Where request is RenderRequest.
PortletRequest
class has method getAttribute()
You can treat it like HttpServletRequest
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With