I have a JSP file containing code to populate a JavaScript array from data in the model. The JSP looks as follows:
data.addRows([
<c:forEach items="${AuditsByTime}" var="row">
[new Date(${row.key})<c:forEach items="${row.value}" var="c">,${c}</c:forEach>],
</c:forEach>
]);
NetBeans reports a syntax error on the final ]);
(all 3 underlined) and reports the error:
"Expected ; but found ]".
The data itself is in the form Map<Long, int[]>
in Java.
If I remove the inner forEach
data.addRows([
<c:forEach items="${AuditsByTime}" var="row">
[new Date(${row.key})],
</c:forEach>
]);
then it no longer reports an error. In both cases though the page is generated and both looks and works perfectly.
I found this: http://forums.netbeans.org/topic54289.html but it seems to be discussing a different problem as in this case I do have an error location specified in the file.
Is there a subtle problem here I've missed or have I just confused the NetBeans parser? Is there anything simple I can do to remove the error report?
If my code is broken I'll fix it, if it's the NetBeans parser then I'll report it as a bug.