title: how to create two actions on the same Controller for the same jsp page in spring-mvc
body: <p>the problem is that i want to create two actions in a controller for the same jsp page(main.jsp)
    the first action is executed in the moment of redirection  to the main.jsp page, to display the details of a product , and the second is associated to a button.
  how to indicate to spring wish method to call ??</p>
  
  <p>Controller : </p>
  
  <pre><code> @RequestMapping(value = "pages/main", method = RequestMethod.GET)
   public String detailProduct(final Model model, @RequestParam String id) {
  
      ProductDTO product = productService.getProduct(Long.parseLong(id));
      ProductModel productbean = mapperDozerBean.map(product, ProductModel.class);
  
      model.addAttribute("detailProduct", productbean);
  
      return detailView;
  }
  
  @RequestMapping(value = "pages/main", method = RequestMethod.GET)
  public String addToCaddy(final Model model, @RequestParam String id,String action) {
  
      ProductDTO product = productService.getProduct(Long.parseLong(id));
  
      ...
  
      return caddyView;
  }
  </code></pre>
  
  <p>jsp : main.jsp</p>
  
  <pre><code>...
      &lt;div id="description"&gt;
              &lt;h1&gt;${detailProduct.name}&lt;/h1&gt;
              &lt;strong id="price"&gt;
                  &lt;span&gt;previously &amp;pound;299.00&lt;/span&gt; ${detailProduct.price}dhs
              &lt;/strong&gt;    
              &lt;p&gt;${detailProduct.description}&lt;/p&gt; 
              &lt;p&gt;
                  &lt;button type="submit" name="addToCaddy" onclick="location.href='/main.do?id=${detailProduct.id}?'" class="continue" value="addToCaddy" &gt;Ajouter au panier&lt;/button&gt; ...
  </code></pre>