Sylar
Sylar

Reputation: 2333

It it possible to read a page request parameter from portlet?

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

Answers (3)

Tina Agrawal
Tina Agrawal

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

Dragisa Krsmanovic
Dragisa Krsmanovic

Reputation: 596

I haven't yet found a way besides using platform specific class com.liferay.portal.util.PortalUtil.

Upvotes: 1

Jaromir Hamala
Jaromir Hamala

Reputation: 1890

PortletRequest class has method getAttribute()

You can treat it like HttpServletRequest.

Upvotes: 1

Related Questions