27 March, 2012

Passing Parameters on liferay page link

Hi,

we have to create a jsp hook by modifying render_portlet.jsp.

Below is the sample code to set in dynamic request,
/**  Fix added to pass http request parameters to the portlet only for parameter names that start with '_eventId' --- begin  **/
if(renderRequestImpl.getHttpServletRequest() instanceof com.liferay.portal.servlet.NamespaceServletRequest){
        com.liferay.portal.servlet.NamespaceServletRequest namedDynamicRequest =
                (com.liferay.portal.servlet.NamespaceServletRequest)renderRequestImpl.getHttpServletRequest();

        java.util.Enumeration elements = originalRequest.getParameterNames();

        if(elements != null){
                while(elements.hasMoreElements()){
                        String element = (String) elements.nextElement();
                        if(element.startsWith("_eventId")){
                                namedDynamicRequest.setParameter(element, originalRequest.getParameter(element));
                        }
                }
        }
}
 **  Fix added to pass http request parameters to the portlet only for parameter names that start with '_eventId' --- end  **/


In Spring how to access is given below


         /**
  * This is invoked as below example:
  * /page1?_eventId=xyz
  * 
  */
 @RequestMapping(params = "xyz")
 public String loadPage_with_eventId(ModelMap model, RenderRequest renderRequest){
   
  //Do here operations
 }

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...