
URL Parameters in Portlets
(从 Grabbing url parameters parameters from 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");
30672 查看