views:

37

answers:

1

I'm using JSTL to generate a JavaScript object in a bit of inline script in a JSP, like this:

<script>
    var data = [
        <c:forEach items="${MyData}" var="Datum" varStatus="status">
        {
            foo: ${Datum.foo},
            bar: '${Datum.bar}',
        }<c:if test="${not status.last}">,</c:if>
        </c:forEach>
    ];
</script>

and Eclipse is totally unable to validate it. The HTML it generates is correct - so how do I make Eclipse stop trying to interpret/validate the JavaScript?

I've come across a number of similar questions here on SO, but none of them worked - including going to Preferences -> Validation and checking the "Suspend all validators" box!

A: 

Did you try to escape the code with CDATA?

<script>
  //<![CDATA[
      ...
  //]]>
</script>

With or without //

Mic
Much as I wish that fixed things - no such luck.
Matt Ball