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:

Create Servlet Project as Module

You would have seen that many times we are writing out own servlet in Liferay portal to achieve some specific use case. In DXP, You can st...