Reputation: 3085
I am sending an arrayList from a java file to a .jsp file
In order to receive that array I used the following code
var words =
[
<c:forEach begin="0" items="${requestScope.WordList}" var = "word">
word,
</c:forEach>
];
however it is not working .. any Idea of how to do it ?
Upvotes: 0
Views: 3022
Reputation: 49372
Possible fix (Bad fix):
var words =
[
<c:forEach items="${requestScope.WordList}" var="word"
varStatus="status">
"${word}"<c:if test="${not status.last}">,</c:if>
</c:forEach>
];
OR
Convert the Java ArrayList
to JSON
String, and use JSON.parse()
to get Javascript object.
Upvotes: 1