I have problem gatting the data from sevlet by using sAjaxsource??
I have problem gatting the data from sevlet by using sAjaxsource??
Pinja_Raja
Posts: 2Questions: 0Answers: 0
Here I am posting my JSP and Servlet code snippets
var oTable = $("#webExcelTool").dataTable({
"sPaginationType" : "full_numbers",
// "sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "media/swf/copy_csv_xls_pdf.swf"
},
"bJQueryUI" : true,
"sDom": 'T<"clear"><"H"lfr>t<"F"ip>',
"bProcessing": true,
"bServerSide": true,
"iDisplayLength": 10,
//"bDeferRender": true,
"sAjaxSource": "<%=request.getContextPath()%>/sAjaxsourceServlet",
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax( {
"dataType": 'json',
"type": 'POST',
"url": sSource,
"data": aoData,
"success": fnCallback,
"error": function(jqXHR, textStatus, errorThrown) {
console.log(txtStatus, errorThrown); // use alert() if you prefer
}
} );
}
} );
in the servlet I'm doing this and can able to navigate till the end of servlet successfully but ...my jsp page still shows processing and loading
JsonElement element = gson.toJsonTree(alExcelDataRows,
new TypeToken() {
}.getType());
JsonArray aoData = element.getAsJsonArray();
System.out.println("jsonArray == " + aoData);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
//response.getWriter().print(jsonArray);
response.getWriter().write(new Gson().toJson(aoData));
var oTable = $("#webExcelTool").dataTable({
"sPaginationType" : "full_numbers",
// "sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "media/swf/copy_csv_xls_pdf.swf"
},
"bJQueryUI" : true,
"sDom": 'T<"clear"><"H"lfr>t<"F"ip>',
"bProcessing": true,
"bServerSide": true,
"iDisplayLength": 10,
//"bDeferRender": true,
"sAjaxSource": "<%=request.getContextPath()%>/sAjaxsourceServlet",
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax( {
"dataType": 'json',
"type": 'POST',
"url": sSource,
"data": aoData,
"success": fnCallback,
"error": function(jqXHR, textStatus, errorThrown) {
console.log(txtStatus, errorThrown); // use alert() if you prefer
}
} );
}
} );
in the servlet I'm doing this and can able to navigate till the end of servlet successfully but ...my jsp page still shows processing and loading
JsonElement element = gson.toJsonTree(alExcelDataRows,
new TypeToken() {
}.getType());
JsonArray aoData = element.getAsJsonArray();
System.out.println("jsonArray == " + aoData);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
//response.getWriter().print(jsonArray);
response.getWriter().write(new Gson().toJson(aoData));
This discussion has been closed.
Replies