1.js中使用
<script>
var a='${变量名}';//注意变量名一定要和setAttribute中设置的变量名相同
</script>
2.html中使用
${变量名}
示例:
<table id="treedg" data-options="toolbar:'#tb'" > <c:if test="${fieldMaxLevel!=0}"> <c:if test="${frozenFields!=null}"> <!-- 冻结列一定要在列表最左侧,并且不可跳跃式冻结,单层次列,不具有合并属性 --> <thead data-options="frozen:true"> <tr> <c:forEach var ="item" items='${frozenFields}'> <c:choose> <c:when test="${item.isCollapse>0}"> <th data-options="field:'${item.field}',width:${item.width},halign:'${item.halign}',align:'${item.align}',formatter:${item.formatterFun},styler:${item.stylerFun}" >${item.title} <i id="${item.field}" class="fa-minus-square-o" style="cursor:pointer" οnclick="collapse(this,'${item.collapseFields}')"></i></th> </c:when> <c:otherwise> <th data-options="field:'${item.field}',width:${item.width},halign:'${item.halign}',align:'${item.align}',formatter:${item.formatterFun},styler:${item.stylerFun}" >${item.title}</th> </c:otherwise> </c:choose> </c:forEach> </tr> </thead> </c:if> <thead> <c:forEach begin="1" end="${fieldMaxLevel}" var="i"> <tr> <c:forEach var ="item" items='${commonFields}'> <c:if test="${item.fieldLevel==i}"> <c:choose> <c:when test="${item.isCollapse>0}"> <th data-options="field:'${item.field}',width:${item.width},halign:'${item.halign}',align:'${item.align}',formatter:${item.formatterFun},styler:${item.stylerFun}" rowspan="${item.rowspan}" colspan="${item.colspan}">${item.title} <i id="${item.field}" class="fa-minus-square-o" style="cursor:pointer" οnclick="collapse(this,'${item.collapseFields}')"></i></th> </c:when> <c:otherwise> <th data-options="field:'${item.field}',width:${item.width},halign:'${item.halign}',align:'${item.align}',formatter:${item.formatterFun},styler:${item.stylerFun}" rowspan="${item.rowspan}" colspan="${item.colspan}">${item.title}</th> </c:otherwise> </c:choose> </c:if> </c:forEach> </tr> </c:forEach> </thead> </c:if> </table>