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

6
  • Yes, It can't. What is your question? Commented Oct 4, 2016 at 15:39
  • How i can do it ?? Commented Oct 4, 2016 at 15:40
  • Send list in body of your request. Commented Oct 4, 2016 at 15:42
  • Since it is post request you can send it in request body Commented Oct 4, 2016 at 15:44
  • You should send it in the POST body Commented Oct 4, 2016 at 17:16

2 Answers 2

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){
...
} 
Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.