The problem of writing jstl in jquery

is to use c:forEach to view the result set in the database on the jsp page. The background output has a value, and there is also a value in HTML, but it is not possible to put it in jquery.
this is what it used to be:

$( document ).ready( function() {
        var entries = [ 
    { label: "baidu", url: "http://www.baidu.com", target: "_top" },         
    { label: "taobao", url: "http://www.taobao.com", target: "_top" },         

        ];

it won"t work like this:

$( document ).ready( function() {
        var entries = [ 
<c:forEach items="${CATEGORIES}"  var="item" varStatus="status">      
    { label:${item.category_name}, url: "http://www.taobao.com", target: "_top" },         

</c:forEach>  

        ];

I don"t quite understand. Should there be no conflict between jstl and jquery, or did I write it wrong?

Mar.10,2021

Don't you need to learn to debug your development programs now?

the value of your label must be enclosed in quotation marks to be a string.

Menu