title: Liferay get parameter from render request in mvc portlet
body: <p>I have a big problem with Liferay portal. I have used both 6.1 and 6.2 but they behave the same in my case. I would be grateful if someone could help me with this.</p>
  
  <p>I have searched everywhere on the internet for more than an year and I still can't find a solution to this problem. The explanation is either that I don't know how to do the simplest of tasks, or the system is broken. Ok, here it goes...</p>
  
  <p>How do you obtain in a MVC portlet a parameter from the renderRequest and what is the explanation for the liferay behavior when it comes to parameters?</p>
  
  <p>It should seem like the simplest of tasks, but obviously for me it never worked as it should, otherwise I wouldn't be here expressing my frustrations. I always worked around this, by using the http servlet request together with other tricks.
  This is what I am trying: (in the past I tried everything imaginable, I have used the correct-marked answers from forums which were supposed to do exactly this, but without luck)</p>
  
  <ul>
  <li><p>in one jsp i am creating a portlet URL programmatically:</p>
  
  <p>HttpServletRequest servletRequest = PortalUtil.getHttpServletRequest(renderRequest);</p>
  
  <p>PortletURL createTeamURL = PortletURLFactoryUtil.create(servletRequest, portletName, plid, PortletRequest.RENDER_PHASE);
  createTeamURL.setParameter("MyParameter", String.valueOf(Page.Pages.CREATE_TEAM));</p></li>
  <li><p>then i change via js the current url to this portlet url, and after the page reloads i can see my parameter in the browser address bar, with the correct portlet id as prefix and with the correct value.</p></li>
  <li><p>in the jsp that is rendered i am reading the parameter like so:</p>
  
  <p>if((value = renderRequest.getParameter("MyParameter")) != null)
  {
      p = Integer.valueOf(value.toString());
  }</p></li>
  </ul>
  
  <p>or like so:</p>
  
  <pre><code>if((value = renderRequest.getParameter(renderResponse.getNamespace() + "MyParameter")) != null)
  {
      p = Integer.valueOf(value.toString());
  }
  </code></pre>
  
  <ul>
  <li>or like tons of other tries which i found on forums, because an official documentation is nowhere to be found (something like explained classes, methods, attributes etc).</li>
  </ul>
  
  <p>The conclusion is that every time the call to getParameter() returns null.</p>
  
  <p>Well, that's about it. I am seriously looking for an explanation for this issue, as it really makes me hate the toolbox that i'm using and to think that it belongs in the trash. Hope I'm wrong.</p>