0
List<SampleModel> data = service.getdata();
model.addAttribute("modeldata",data);
return "jsp";
有沒有一種方法可以方便地訪問/使用JSP模型屬性的javascript函數?我試圖在循環中訪問它,但沒有結果。
樣品:
<script type="text/javascript">
$(document).ready(function() {
sampleFunction();
});
sampleFunction() {
for (i=0;i<=10;i++) {
console.log(${modeldata[i].sampledatapath});
}
}
</script>
謝謝!
https://stackoverflow.com/questions/4803906/reading-a-jsp-variable-from-javascript – spiritwalker