Thymeleaf forEach loop in JavaScript
This is the working solution with Thymeleaf 3.0.2:
<script th:inline="javascript">
/*<![CDATA[*/
/*[# th:each="page : ${pages}"]*/
...
var l = new google.maps.LatLng(/*[[${page.lat}]]*/, /*[[${page.long}]]*/);
...
/*[/]*/
/*]]>*/
</script>
Why and how it works is explained here: [MAJOR FEAT] New syntax for textual template modes #395