1

I have two Java objects of the form:

List<Integer> numberList = new ArrayList<Integer>() {{
    add(2);
    add(4);
    add(8);
}};

And:

List<String> alphaList = new ArrayList<String>() {{
    add("two");
    add("four");
    add("eight");
}};

And rendered to a PlayFramework view called index.scala.html using:

return ok(index.render(numberList, alphaList));

I must manipulate these arrays within a javascript script in index.scala.html. How do I do this?

2 Answers 2

1

Solved by using

var javascriptVariable = @javaVariable;
Sign up to request clarification or add additional context in comments.

Comments

0

Try:

var numList = @numberList
var aList = @alphaList

This turns them into javascript arrays.

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.