2

I have tried to send it like this:

$scope.listDms = []
$http.post('url?listDomain='+$scope.listDms);

in spring controller

@RequestMapping('url')
public getDomains(@RequestParam List<Domain> listDomain){
...
}

but the app can't bind from String to List

2 Answers2

2

the solution is to send array in the body of request

$scope.listDms = []
$http.post('url',$scope.listDms);

in spring controller

@RequestMapping('url')
public getDomains(@RequestBody List<Domain> listDomain){
...
} 
0

Since it is a post request you can send it in request body but if you have to send the data as url paramter you need to serialize the data before sending.

$http.post('url?listDomain='+JSON.stringify($scope.listDms));

However if the data consists any of the reserved special characters like '?,&,/....' you then need to escape your data before sending it to server side.

Escaping special characters

Community
  • 1
  • 1
Gangadhar Jannu
  • 4,136
  • 6
  • 29
  • 49