This wiki does not contain official documentation and is currently deprecated and read only. Please try reading the documentation on the Liferay Developer Network, the new site dedicated to Liferay documentation. DISCOVER Build your web site, collaborate with your colleagues, manage your content, and more. DEVELOP Build applications that run inside Liferay, extend the features provided out of the box with Liferay's APIs. DISTRIBUTE Let the world know about your app by publishing it in Liferay's marketplace. PARTICIPATE Become a part of Liferay's community, meet other Liferay users, and get involved in the open source project. URL Parameters in Portlets
Table of Contents [-]
Introduction #
This article describes how to grab variables passed in through url parameters, from within a portlet.
Example: http://whatever.com/page?param=something
PortalUtil #
Normally your portlet does not have access to this parameter! This is because, by default, the requests passed to your portlets are namespaced and portlets only have access to their namespaced parameters.
You can still grab them easily though if you want to by doing this:
- In a JSP:
String param = PortalUtil.getOriginalServletRequest(request).getParameter("param");
- In a portlet render:
HttpServletRequest request = PortalUtil.getHttpServletRequest(renderRequest);String param = PortalUtil.getOriginalServletRequest(request).getParameter("param");
30706 Views