Possible fix (incorrect correction):
var words = [ <c:forEach items="${requestScope.WordList}" var="word" varStatus="status"> "${word}"<c:if test="${not status.last}">,</c:if> </c:forEach> ];
OR
Convert Java ArrayList to JSON String and use JSON.parse() to get a Javascript object.
source share