Populating JavaScript Array from JSP List

后端 未结 3 837
[愿得一人]
[愿得一人] 2020-12-01 16:24

Ok so perhaps someone can help me with a problem I\'m trying to solve. Essentially I have a JSP page which gets a list of Country objects (from the method referenceData() fr

3条回答
  •  忘掉有多难
    2020-12-01 17:18

    The primary problem in your code is that you forgot to put "status.index" inside ${ }.

    countries[${status.index}] = new Array();
    

    Now, that said, that would be a pretty bad way to do things because you'd end up with a lot of Javascript code in your page. Much much better to create the list using Javascript object notation as in the second of @John Hartsock's answers.

提交回复
热议问题