In Liferay some times we will face an issue to read the parameters from the URL (it may be actionURL or renderURL), it will give null value when you try to read the parameters with simple 'actionRequest' or 'renderRequest' in such scenario we need to read the parameters from the 'OriginalServletRequest'. the below example clearly shows how to read those parameters.
imports :-
import javax.servlet.http.HttpServletRequest;
import com.liferay.portal.util.PortalUtil;
import javax.portlet.ActionRequest;
java code :-
HttpServletRequest originalRequest = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(actionRequest));
String STATUS = originalRequest.getParameter("STATUS");
//actionRequest for action method and renderRequest for rendermethod.
jsp code :- suppose you need to read in your jsp page then read the parameter in the following way.
HttpServletRequest originalRequest = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));
String STATUS = originalRequest.getParameter("STATUS");
Note:- Suppose we are reading the parameters from the URL which are passing by any third party server(ex: payment gateways) in such type of scenarios, we need to read the parameters in the above way.
imports :-
import javax.servlet.http.HttpServletRequest;
import com.liferay.portal.util.PortalUtil;
import javax.portlet.ActionRequest;
java code :-
HttpServletRequest originalRequest = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(actionRequest));
String STATUS = originalRequest.getParameter("STATUS");
//actionRequest for action method and renderRequest for rendermethod.
jsp code :- suppose you need to read in your jsp page then read the parameter in the following way.
HttpServletRequest originalRequest = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));
String STATUS = originalRequest.getParameter("STATUS");
Note:- Suppose we are reading the parameters from the URL which are passing by any third party server(ex: payment gateways) in such type of scenarios, we need to read the parameters in the above way.