Reputation: 2333
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.
Upvotes: 4
Views: 1907
Reputation: 616
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.
Upvotes: 6
Reputation: 596
I haven't yet found a way besides using platform specific class com.liferay.portal.util.PortalUtil
.
Upvotes: 1
Reputation: 1890
PortletRequest
class has method getAttribute()
You can treat it like HttpServletRequest
.
Upvotes: 1