1

I would like to pass data from Spring MVC to javascript but I am not sure what is the best way to do it.

Say, in javascript, there an array

var myArray = new Array(); 

In backend java, there is an array

int[] myArray = new int[100];

What is the best way to pass this array to the front end javascript. What about multiple arrays as well?

Thanks!

1 Answer 1

0

You'll want to json-ify your array. Best way is to have your view use the built in MappingJacksonHttpMessageConverter.

Might want to look at this thread:

How to configure MappingJacksonHttpMessageConverter while using spring annotation-based configuration?

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.