jsp页面获取集合的长度

createTime--2016年10月12日16:20:02
Author:Marydon
jsp页面获取集合的长度

  在jsp页面与js中不能通过${list.size}取列表长度,而是引入jstl标签库的fn标签

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
${fn:length(list)}获取

  例子:
    alert('${fn:length(model.data)}');
  不能是这样:
    var studentList = '${model.data}';
    alert(studentList.length);
    或
    alert(${model.data.length});

原文地址:https://www.cnblogs.com/Marydon20170307/p/6524113.html