title: Angularjs Spring controller form submission
body: <p>Java - spring controller - Angularjs form submission</p>
  
  <p>Problem is with <code>"@RequestBody OfferForm data"</code> when i submit form i get error "404 bad request" but when i replace OfferForm bean with String object it works fine and display form data in json format.</p>
  
  <p>any help appreciated.</p>
  
  <p>Following is my angularjs function code</p>
  
  <pre><code>$scope.submitOffer = function() {
                        alert('submitOffer')
                      $http({method: 'POST', url: '/offer/submitOffer', data: $scope.formData}).
                      success(function(data, status, headers, config) {
                          $scope.successMsg = data;
                      }).
                      error(function(data, status, headers, config) {
                          if(status == 400) {
                               $scope.errMessages = data;
                          } else {
                              alert('Unexpected server error.');
                          }
  
                      });         
                  };
  </code></pre>
  
  <p>Following is my controller code</p>
  
  <pre><code>@RequestMapping(value="offer")
  public class OfferController{
      @RequestMapping(value = "/submitOffer", method = RequestMethod.POST)
      @ResponseBody public ResponseEntity&lt;?&gt; postForm(@RequestBody OfferForm data) {
  
          System.out.println(data);
  
          return new ResponseEntity&lt;String&gt;("Offer Created", HttpStatus.OK);
  
      }
  }
  </code></pre>
  
  <p>Following is my java bean</p>
  
  <pre><code>public class OfferForm {
  
      private String offerType;
      private String offerTitle;
  
  
      public String getOfferType() {
          return offerType;
      }
      public void setOfferType(String offerType) {
          this.offerType = offerType;
      }
      public String getOfferTitle() {
          return offerTitle;
      }
      public void setOfferTitle(String offerTitle) {
          this.offerTitle = offerTitle;
      }
  
  }
  </code></pre>