I have a problem at JSP.

I have a problem at JSP.

m44mirim44miri Posts: 12Questions: 0Answers: 0
edited February 2011 in General
I have a problem at JSP.
server-side is:
http://datatables.net/development/server-side/jsp

And Master page is :
[code]









@import "WEB-CSS/datatables_page.css";
@import "WEB-CSS/datatables_table.css";
@import "WEB-CSS/datatables_table_jui.css";






var oTable;
var giRedraw = false;

$(document).ready(function() {

/* Init the table */
oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "http://localhost:8080/oapc/server-side/RecvdFaxHylafax.jsp",

"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push( { "name": "my_field", "value": "my_value" } );
$.ajax({
"dataType": 'json',
"type":"POST",
"url":sSource,
"data":aoData,
"success":fnCallback

});
$.getJSON( sSource, aoData, function (json) {

/* Callback processing */

oCache.lastJson = jQuery.extend(true, {}, json);

if ( oCache.iCacheLower != oCache.iDisplayStart )

{

json.aaData.splice( 0, oCache.iDisplayStart-oCache.iCacheLower );

}

json.aaData.splice( oCache.iDisplayLength, json.aaData.length );

fnCallback(json)

} );

}
} );
} );


/* Get the rows which are currently selected */
/*function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();

for ( var i=0 ; i

Replies

  • big-dealbig-deal Posts: 38Questions: 0Answers: 0
    If it is empty it can be so beacuse it is empty (no data in your db), or there were a problem with the jsp that you are calling.

    Please add to the jsp that you are calling a log print - just print to file the returned value before you out.print() it.
    Then publish here the content.

    My guess is that there is a problem there.

    Check that out.

    big-deal
  • m44mirim44miri Posts: 12Questions: 0Answers: 0
    Not Exactly ,I said befor that server-side is True.for trust ,after out.print(result); typed Systestem.out.println(result);
    and at te Glassfish logger saw [code]{ "aaData": [ ["Trident","Internet Explorer 4.0","Win 95+","4","X"], ["Trident","Internet Explorer 5.0","Win 95+","5","C"], ["Trident","Internet Explorer 5.5","Win 95+","5.5","A"], ["Trident","Internet Explorer 6","Win 98+","6","A"], ["Trident","Internet Explorer 7","Win XP SP2+","7","A"], ["Trident","AOL browser (AOL desktop)","Win XP","6","A"], ["Gecko","Firefox 1.0","Win 98+ / OSX.2+","1.7","A"], ["Gecko","Firefox 1.5","Win 98+ / OSX.2+","1.8","A"], ["Gecko","Firefox 2.0","Win 98+ / OSX.2+","1.8","A"], ["Gecko","Firefox 3.0","Win 2k+ / OSX.3+","1.9","A"], ["Gecko","Camino 1.0","OSX.2+","1.8","A"], ["Gecko","Camino 1.5","OSX.3+","1.8","A"], ["Gecko","Netscape 7.2","Win 95+ / Mac OS 8.6-9.2","1.7","A"], ["Gecko","Netscape Browser 8","Win 98SE+","1.7","A"], ["Gecko","Netscape Navigator 9","Win 98+ / OSX.2+","1.8","A"], ["Gecko","Mozilla 1.0","Win 95+ / OSX.1+",1,"A"], ["Gecko","Mozilla 1.1","Win 95+ / OSX.1+",1.1,"A"], ["Gecko","Mozilla 1.2","Win 95+ / OSX.1+",1.2,"A"], ["Gecko","Mozilla 1.3","Win 95+ / OSX.1+",1.3,"A"], ["Gecko","Mozilla 1.4","Win 95+ / OSX.1+",1.4,"A"], ["Gecko","Mozilla 1.5","Win 95+ / OSX.1+",1.5,"A"], ["Gecko","Mozilla 1.6","Win 95+ / OSX.1+",1.6,"A"], ["Gecko","Mozilla 1.7","Win 98+ / OSX.1+",1.7,"A"], ["Gecko","Mozilla 1.8","Win 98+ / OSX.1+",1.8,"A"], ["Gecko","Seamonkey 1.1","Win 98+ / OSX.2+","1.8","A"], ["Gecko","Epiphany 2.20","Gnome","1.8","A"], ["Webkit","Safari 1.2","OSX.3","125.5","A"], ["Webkit","Safari 1.3","OSX.3","312.8","A"], ["Webkit","Safari 2.0","OSX.4+","419.3","A"], ["Webkit","Safari 3.0","OSX.4+","522.1","A"], ["Webkit","OmniWeb 5.5","OSX.4+","420","A"], ["Webkit","iPod Touch / iPhone","iPod","420.1","A"], ["Webkit","S60","S60","413","A"], ["Presto","Opera 7.0","Win 95+ / OSX.1+","-","A"], ["Presto","Opera 7.5","Win 95+ / OSX.2+","-","A"], ["Presto","Opera 8.0","Win 95+ / OSX.2+","-","A"], ["Presto","Opera 8.5","Win 95+ / OSX.2+","-","A"], ["Presto","Opera 9.0","Win 95+ / OSX.3+","-","A"], ["Presto","Opera 9.2","Win 88+ / OSX.3+","-","A"], ["Presto","Opera 9.5","Win 88+ / OSX.3+","-","A"], ["Presto","Opera for Wii","Wii","-","A"], ["Presto","Nokia N800","N800","-","A"], ["Presto","Nintendo DS browser","Nintendo DS","8.5","C/A1"], ["KHTML","Konqureror 3.1","KDE 3.1","3.1","C"], ["KHTML","Konqureror 3.3","KDE 3.3","3.3","A"], ["KHTML","Konqureror 3.5","KDE 3.5","3.5","A"], ["Tasman","Internet Explorer 4.5","Mac OS 8-9","-","X"], ["Tasman","Internet Explorer 5.1","Mac OS 7.6-9","1","C"], ["Tasman","Internet Explorer 5.2","Mac OS 8-X","1","C"], ["Misc","NetFront 3.1","Embedded devices","-","C"], ["Misc","NetFront 3.4","Embedded devices","-","A"], ["Misc","Dillo 0.8","Embedded devices","-","X"], ["Misc","Links","Text only","-","X"], ["Misc","Lynx","Text only","-","X"], ["Misc","IE Mobile","Windows Mobile 6","-","C"], ["Misc","PSP browser","PSP","-","C"], ["Other browsers","All others","-","-","U"] ] }[/code]
    so,server-side is True.I Think that Master Page have problem.can you check it?
  • m44mirim44miri Posts: 12Questions: 0Answers: 0
    I think that problem is in the these sources:
    [code]
    oTable = $('#example').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sPaginationType": "full_numbers",
    "sAjaxSource": "http://localhost:8080/oapc/server-side/RecvdFaxHylafax.jsp",

    "fnServerData": function (sSource, aoData, fnCallback) {
    aoData.push( { "name": "my_field", "value": "my_value" } );
    $.ajax({
    "dataType": 'json',
    "type":"POST",
    "url":sSource,
    "data":aoData,
    "success":fnCallback

    });
    $.getJSON( sSource, aoData, function (json) {

    /* Callback processing */

    oCache.lastJson = jQuery.extend(true, {}, json);
    [/code]

    can you call me that, What is the correct code?
  • big-dealbig-deal Posts: 38Questions: 0Answers: 0
    Well ...
    In your data I only see aaData.
    You need to return some other things with aaData such as:
    "sEcho" => intval($_GET['sEcho']),
    "iTotalRecords" => $iTotal,
    "iTotalDisplayRecords" => $iFilteredTotal.

    To be exact, sEcho is very importent.
    Allan was asked about it and in response he said:
    "It is simply information that DataTables needs to know about the data being sent back, in order to be able to render".

    So - for all I see you don't return all needed data such as the total of records and the total of filttered records - as well as sEcho.

    Maybe that is why your table doesn't render.
    Try that and tell me how it went.
  • m44mirim44miri Posts: 12Questions: 0Answers: 0
    Oh ..My God
    I don't saw This method at the datatables.net.According to server-side(http://datatables.net/development/server-side/jsp) ,can you get me what write me exactlly?
    please get me a link or write a example.
    Thank you
  • m44mirim44miri Posts: 12Questions: 0Answers: 0
    I did write in this way:
    [code]

    var oTable;
    var giRedraw = false;

    $(document).ready(function() {

    oTable = $('#example').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sPaginationType": "full_numbers",
    "sAjaxSource": "http://localhost:8080/oapc/server-side/RecvdFaxHylafax.jsp",
    "fnServerData": function ( sSource, aoData, fnCallback,iTotalRecords,sEcho,iTotalDisplayRecords ) {
    $.ajax( {
    "dataType": 'json',
    "type": "POST",
    "url": sSource,
    "data": aoData,
    "success": fnCallback,
    "iFilteredTotal":iTotalDisplayRecords,
    "iTotal":iTotalRecords,
    "intval($_GET['sEcho'])":sEcho
    } );
    }
    } );
    } );


    [/code]
    But don't work yet.is this true?
  • big-dealbig-deal Posts: 38Questions: 0Answers: 0
    Your display jsp was ok - don't change it.
    You need to change "http://localhost:8080/oapc/server-side/RecvdFaxHylafax.jsp":

    As you can see in http://datatables.net/development/server-side/jsp:
    [code]
    result.put("iTotalRecords", total);
    result.put("iTotalDisplayRecords", totalAfterFilter);
    result.put("aaData", array);
    response.setContentType("application/json");
    response.setHeader("Cache-Control", "no-store");
    out.print(result);
    [/code]
    There - you set iTotalRecords and iTotalDisplayRecords in the results (which is a json object) - and then prints it.
    The final output of that page would be something like:
    [code]
    {
    'iTotalDisplayRecords" : 19,
    "iTotalRecords " : 40,
    "aaData" : [[1,2,3,4], [5,6,7,8]]
    }
    [/code]


    Just fix your http://localhost:8080/oapc/server-side/RecvdFaxHylafax.jsp .



    big-deal
  • m44mirim44miri Posts: 12Questions: 0Answers: 0
    I don't understand.!!!
    Please call me about part of Script.
    at the this code Should i change things? or No?
    [code]
    /* POST data to server */
    $(document).ready(function() {
    $('#example').dataTable( {
    "sAjaxSource": "data_source.php",
    "fnServerData": function ( sSource, aoData, fnCallback ) {
    /* Add some data to send to the source, and send as 'POST' */
    aoData.push( { "name": "my_field", "value": "my_value" } );
    $.ajax( {
    "dataType": 'json',
    "type": "POST",
    "url": sSource,
    "data": aoData,
    "success": fnCallback
    } );
    }
    } );
    } );
    [/code]
  • m44mirim44miri Posts: 12Questions: 0Answers: 0
    Really I don't understand.please call me more explicit..I am really tired .
  • m44mirim44miri Posts: 12Questions: 0Answers: 0
    all of this sources are at the my program but don't work.table is empty.I thing problem is at the script code.
  • m44mirim44miri Posts: 12Questions: 0Answers: 0
    Can you get me your address mail that I sent source to you for trace?
  • m44mirim44miri Posts: 12Questions: 0Answers: 0
    My problem solved completely .
    My problem was this:
    at the JSP page(server-side) was code.I did erase this & solved my problem :)
This discussion has been closed.