Datatable 1.10.9在为每个循环使用jstl的动态列和数据时不进行ajax调用。得到ajax Json错误。 我的代码是:jsp的顶线
输出获取:没有获取表中的数据,它只显示列名,但没有返回ajax响应
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<fmt:setLocale value="en" scope="session" />
<fmt:setBundle basename="ApplicationResources" scope="session" />
some other datatable refrences here .....
<script language="JavaScript">
$(document).ready( function () {
var table;
table= $('#example).DataTable( {
"processing": true,
dom: 'BRlfrtip',
"ajax": {
"url": "/example.so",
"type": "GET"
},
"columns": [
<c:forEach items="${TableFields}" var="field">
{"title":"<fmt:message key="label.${field.key}" />", "data":"${field.key}", "name":"${field.key}" },
] </c:forEach>
} );
</script>
html code :
</head>
<body>
<fmt:setLocale value="en" scope="session" />
<fmt:setBundle basename="ApplicationResources" scope="session" />
<h2><font color="#4B0082">List All Data</font></h2>
<div id="gridContainer">
<div id="gridContent" class="blockContent">
<div style="width: auto; height: 750px; overflow-x: auto; overflow-y: auto;">
<table id="example" class="display " cellspacing="0" width="100%" >
<thead></thead>
<tfoot>
</tfoot>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
using spring mvc ,controller has list method .