title: How to pass String in POST request from AngularJS to Http Servlet?
body: <p>Here is my Angular Code(Get request is working fine but not Post request. I am receving null in carrier_id on Servlet side).</p>
  
  <p>app.js</p>
  
  <pre><code>var app = angular.module( "admin" , []);
  
  
  app.config(function ($httpProvider){
      // set the Content-Type header globally
      $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
  
  // define ajax call behavior globally
  // set up global transformRequest function
  $httpProvider.defaults.transformRequest = function(data){
  
      if (data === undefined) {
          return data;
      }
      return $.param(data);
  };})
  
  app.controller('mainController', function($scope, $http, $window){
  
  $scope.fileList =[];
  $scope.selectedFile = null;
  $http({
      method: 'GET',
      url :'hrp/filelist' 
  }).success( function(data,status,headers,config){ 
      data.file_list.splice(0, 1) // to remove header row
      $scope.fileList=data.file_list
  
  }).error(function(){
      alert("error")
  })
  $scope.submitFile = function(selectedFile){
      console.log("happy" + selectedFile);
      $http({
          method: 'POST',
          url: 'hrp/carrierInfo',
          data: {carrier_id: selectedFile}
      }).success(function(data){
          alert(data.carrier_id + " &amp; " + data.method_name)
      }).error(function(){
          alert("errors")
      })
  }});
  </code></pre>
  
  <p>And part of Servlet Code: </p>
  
  <pre><code>String carrier_id = (String)request.getAttribute("carrier_id");
  
  response.setContentType("application/json");
  </code></pre>
  
  <p>but it is null.</p>