title: org.springframework.web.bind.MissingServletRequestParameterException : Required Long parameter 'userId' is not present"
body: <p>I am getting an exception while posting a call to Spring controller</p>
  
  <p>Exception is:</p>
  
  <pre><code> org.springframework.web.bind.MissingServletRequestParameterException : Required Long parameter 'userId' is not present"
  </code></pre>
  
  <p>My Javascript file is:</p>
  
  <pre><code>$scope.removeUser = function(user){
          var userId = JSON.stringify(user);
          $http.post('/portal/settings/user/deletecustomeruser', userId).success(function(data){
                  $scope.response = data;
              })
          }
      }
  </code></pre>
  
  <p>The Spring controller code is:</p>
  
  <pre><code>      @RequestMapping( value = "/user/deletecustomeruser", method = RequestMethod.POST , headers="Accept=application/json")
  public @ResponseBody String deleteCustomerUser( @RequestParam (value = "userId") Long userId,
          HttpServletRequest request )
                  throws Exception
                  {
      String returnString = "";
      User user = userService.getUserById( userId );
  </code></pre>
  
  <p>When I put <code>(required = false)</code>, then the <code>userId</code> value became <code>null</code>. 
  The JavaScript controller is clearly sending the <code>"userId"</code> in JSON format, but from the controller side there is some issue.</p>
  
  <p>I checked almost all questions in stackoverflow, but the given solutions didn't help.</p>