26 April, 2012

Read parameter value from URL

In Liferay portlet you can not directly read parameter from URL using http request.
So for that you can use below code to read the parameter value.

You can read URL parameter value for below different situation in liferay :




In JSP:
String paramValue = PortalUtil.getOriginalServletRequest(request).getParameter("paramName");

In   render() :

HttpServletRequest request = PortalUtil.getHttpServletRequest(renderRequest);
String paramValue = PortalUtil.getOriginalServletRequest(request).getParameter("paramName");

In   processAction() :

HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest);
String paramValue = PortalUtil.getOriginalServletRequest(request).getParameter("paramName");

Rate Me:

0 Discussion: