title: Spring Portlet MVC: Forward Request parameters to model
body: <p>I got two views:</p>
  
  <ol>
  <li>Displays some common information about an entity</li>
  <li>Displays more details about this entity</li>
  </ol>
  
  <p>The second view has a link back to the first one. To create the link I need some informations, lets say two ids ("id1" and "id2"). Theses ids are passed to the controller of the second view by request parameters.</p>
  
  <p>To create the back link in the second view, I have to forward the request parameters to the model manualy. This is not very convenient.</p>
  
  <p>Is there any approach to do this forwarding automatically?</p>
  
  <p>Here an example:</p>
  
  <p><strong>Link to details in the first view:</strong></p>
  
  <pre><code>&lt;portlet:renderURL var="detailsUrl"&gt;
      &lt;portlet:param name="action" value="showDetails" /&gt;
      &lt;portlet:param name="id1" value="${entity.id1}" /&gt;
      &lt;portlet:param name="id2" value="${entity.id2}"/&gt;
  &lt;/portlet:renderURL&gt;
  &lt;a href="${detailsUrl}"&gt;Details&lt;/a&gt;
  </code></pre>
  
  <p><strong>Render method in the second controller:</strong></p>
  
  <pre><code>@RenderMapping(params = "action=showDetails")
  public String showDetails (
          @RequestParam("id1") int id1,
          @RequestParam("id2") int id2,
          Model model) {
      // The current unconvenient approach
      model.addAttribute("id1", id1);
      model.addAttribute("id2", id2);
  
      return "showDetails";
  }
  </code></pre>
  
  <p><strong>Back link in the second view:</strong></p>
  
  <pre><code>&lt;portlet:renderURL var="entityUrl"&gt;
      &lt;portlet:param name="action" value="showEntity" /&gt;
      &lt;portlet:param name="id1" value="${id1}" /&gt;
      &lt;portlet:param name="id2" value="${id2}"/&gt;
  &lt;/portlet:renderURL&gt;
  &lt;a href="${entityUrl}"&gt;Back&lt;/a&gt;
  </code></pre>
  
  <p>I searched the internet for houres to find something like a trick I missed. But the only thing I found was: "Spring dose it automatically for you". But I can't confirme this.</p>
  
  <p>Thanks for your help...</p>