Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 302
Sylar Avatar asked Feb 27 '23 19:02

Sylar


2 Answers

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.

like image 173
Tina Agrawal Avatar answered Mar 05 '23 17:03

Tina Agrawal


PortletRequest class has method getAttribute()

You can treat it like HttpServletRequest.

like image 29
Jaromir Hamala Avatar answered Mar 05 '23 17:03

Jaromir Hamala