3. <table cellpadding="0" cellspacing="0" border="0"
Setting up the html class="display" id="example">
<thead>
Add the html elements
<tr>
<th width="10">Last Name</th>
Add headers in a <thead>
<th width="10">First Name</th>
Include an id tag for the table <th width="10">Age</th>
<th width="25">Location</th>
<th width="10">Date</th>
<th width="5">Fatal</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
4. $(document).ready(function() {
var oTable = $('#example').dataTable( {
Setting up the html "bProcessing": true,
This script is added in a script tag "bPaginate": true,
following references to jQuery and "bProcessing": true,
Datables. "bDeferRender":true,
"iDisplayLength":250,
These are the table cell elements "sAjaxSource": "MongoServlet",
"sScrollY": "400px",
Script will run on document load. "aoColumns": [
{ "mDataProp": "lname"},
Datatables will read each value with { "mDataProp": "fname"},
the mDataProp, and populate the { "mDataProp": "age", "sClass": "center"},
JSON in a table cell. { "mDataProp": "location"},
{ "mDataProp": "date"},
MongoServlet is the name of the Java { "mDataProp": "fatal", "sClass": "center"}
class that will run. ]
Servlet will reference a collection in }
MongDB and return a JSON object. );
6. m = new Mongo("localhost");
MongoServlet
(snippets) protected void doPost(()
PrintWriter out = response.getWriter();
DB db = m.getDB("test");
DBCollection coll = db.getCollection("miners");
DBCursor cursor = coll.find();
JSONObject miners = new JSONObject();
Map map = new LinkedHashMap();
List items = new ArrayList();