Reading array from java servlet in javascript

前端 未结 1 992
無奈伤痛
無奈伤痛 2021-01-28 01:14

Hi like the title says I am trying to read an array from my java Servlet. I am trying to read the array in my java script file.

Java servlet code: String graphData[]

相关标签:
1条回答
  • 2021-01-28 02:04

    You can use like this

    <script>
        var graphData = [
        <c:forEach items="${graphData}" var="graph">
            '<c:out value="${graph}" />',  
        </c:forEach>
        ];
        console.log(graphData);
    </script>
    
    0 讨论(0)
提交回复
热议问题