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
 }

Rate Me:

0 Discussion:

Post a Comment

Your Comments on this post

Google Pay Referral Code s34xJ – Earn 180 INR Per Referral

You can use  Google Pay Referral Code s34xJ  and sign up on  Google pay  . Google has increased its referral commission from 51 to 180 INR. ...