title: How to pass a parameter (that identify the primery key of an object) from the view to a controller using Spring MVC?
body: <p>I am pretty new in Spring MVC and I have the following doubt about how correctly create a link into a view page that have to be handled by a method defined into a controller class.</p>
  
  <p>So I have the following situation:</p>
  
  <p>Into a view I use a <strong>model</strong> object name</p>
  
  <pre><code>&lt;c:forEach items="${scuola.twp1007Progettos}" var="progetto" varStatus="itemProgetto"&gt;
  
      &lt;!-- Visualizza il progetto solo se è un progetto PNSD: --&gt;
      &lt;c:if test="${progetto.flgTipPrg == 'P'}"&gt;
          &lt;div class="group-item"&gt;
              &lt;a href="visualizzaProspetto"&gt;
                  &lt;img src="&lt;c:url value="resources/img/icons/projects/PNSD.png" /&gt;"&gt;
              &lt;/a&gt;
  
              &lt;div&gt;
                  &lt;h4&gt;&lt;a href="visualizzaProspetto"&gt;${progetto.codPro}&lt;/a&gt;&lt;/h4&gt;
                  &lt;p&gt;${progetto.twp1009Tipostaprogetto.desTipSta}&lt;/p&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/c:if&gt;
  
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>So, as you can see in the previous code snippet, I have a <strong>progetto</strong> variable that is an instance of a model class named <strong>Twp1007Progetto</strong>. This model class contain some field that I correctly used in the previous code snippet (for example <strong>${progetto.codPro}</strong>).</p>
  
  <p>Ok, untill now I have no problem and I correctly access to the previous property of the <strong>progetto</strong> variable.</p>
  
  <p>In the previous code snippet I also have this link:</p>
  
  <pre><code>&lt;a href="visualizzaProspetto"&gt;
  </code></pre>
  
  <p>where <strong>visualizzaProspetto</strong> is a resource handled by this method defined into a controller class:</p>
  
  <pre><code>@RequestMapping(value = "/visualizzaProspetto", method = RequestMethod.GET)
  public String home(Locale locale, Model model) {
      .....................................................
      .....................................................
      DO SOMETHING
      .....................................................
      .....................................................
  
      return "prospettoRendicontazione";
  }
  </code></pre>
  
  <p>Ok, this is correctly called.</p>
  
  <p>Now my problem is that, when the <strong></strong> link is clicked by the user, I have not to handle the simple <strong>visualizzaProspetto</strong> but I have also to pass a parameter representing the value of the <strong>prgPro</strong> field defined into my <strong>Twp1007Progetto</strong> model object instance (the <strong>${progetto.prgPro}</strong> value) because it is the primary key on the clicked object on the database.</p>
  
  <p>So, what is the best way to do this thing? I know that using Spring I can pass parameter or path variable but I really don't know how correctly handle this situation.</p>
  
  <p>Tnx</p>