title: Spring-MVC : two jsps into one controller with one requestMapping
body: <p>Can I use one request mapping for two jsps? </p>
  
  <p>I am currently calling one request mapping from one controller but one of the jsps doesn't seem to be caught by the controller. </p>
  
  <p>Both jsps have the same form action and same form method:</p>
  
  <p>first.jsp look like this:</p>
  
  <pre><code>&lt;form:form method="POST" action="/ShowroomNav/requestQuote" id="requestQuoteForm"&gt;
  
      &lt;input type="hidden" value=${product.productCode } name="productCodes" /&gt;
      &lt;input type="hidden" id="requestQuoteEmailAddress" name="requestQuoteEmailAddress" /&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>the second.jsp look like this:</p>
  
  <pre><code>        &lt;form:form method="POST" action="/ShowroomNav/requestQuote" id="requestQuoteForm"&gt;
              &lt;input type="hidden" id="requestQuoteEmailAddress" name="requestEmailAddress" /&gt;
          &lt;c:forEach var="product" items="${products}"&gt;
              &lt;input type="hidden" value=${product.productCode } name="productCodes" /&gt;
  
              &lt;div class="box"&gt;
                  &lt;img
                      src="public/productImages/${product.productCode}/${product.productCode}A.jpg"
                      style="max-width: 100%"
                      onclick="productProfile('${product.productCode}')" /&gt;&lt;br /&gt; &lt;label
                      class="name"&gt;${product.productName}&lt;/label&gt;
              &lt;/div&gt;
  
  
          &lt;/c:forEach&gt;
          &lt;/form:form&gt;
  </code></pre>
  
  <p>both of them submits the function by a javascript call of :</p>
  
  <pre><code>  $("#requestQuoteSubmitButton").one("click",function(){
  
          $("#requestQuoteEmailAddress").val($("#requestQuoteEmailAddressModal").val());
  
  
              alert($("#requestQuoteEmailAddress").val());
              $("#requestQuoteForm").submit();
  
    });
  </code></pre>
  
  <p>this is how the controller.java looks like:</p>
  
  <pre><code>@RequestMapping(value = "/requestQuote", method = RequestMethod.POST) // or GET 
  public String requestQuote(@RequestParam("requestQuoteEmailAddress") String requestQuoteEmailAddress, @RequestParam("productCodes") String[] productCodes) {
  
       System.out.println("&gt;&gt;&gt;&gt; requesting quotes &gt;&gt;&gt;&gt;");
  
       for(int i=0; i&lt;productCodes.length; i++) {
           System.out.println(" Product Codes : " + productCodes[i]);
       }
  
       System.out.println("requestQuoteEmailAddress : " + requestQuoteEmailAddress );
       System.out.println("&lt;&lt;&lt;&lt;&lt; requesting quotes &lt;&lt;&lt;&lt;");         
  
       return "productSearch";
   }
  </code></pre>
  
  <p>So I don't know why the second.jsp cannot be caught by the controller as it always shows this error when I try to submit it. </p>
  
  <pre><code> HTTP Status 400 - The request sent by the client was syntactically incorrect.
  </code></pre>
  
  <p>Can somebody help please?</p>