anybody will plz tell me how to do Server side (java) code

anybody will plz tell me how to do Server side (java) code

SandeepMSandeepM Posts: 28Questions: 0Answers: 0
edited June 2012 in Editor
Instead of this will you please elaborate same in java


<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/

/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );

/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "id";

/* DB table to use */
$sTable = "ajax";

/* Database connection information */
$gaSql['user'] = "";
$gaSql['password'] = "";
$gaSql['db'] = "";
$gaSql['server'] = "localhost";

/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/

/*
* MySQL connection
*/
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
die( 'Could not open connection to server' );

mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
die( 'Could not select database '. $gaSql['db'] );


/*
* Paging
*/
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
mysql_real_escape_string( $_GET['iDisplayLength'] );
}


/*
* Ordering
*/
$sOrder = "";
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i $iFilteredTotal,
"aaData" => array()
);

while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i

Replies

  • snarf2larfsnarf2larf Posts: 64Questions: 0Answers: 0
    I don't know java but basically you need to read the data sent to the server from the client, formulate your database query and then return json output to the client.

    See the data sent to the client here and the expected response: http://datatables.net/usage/server-side

    From there you can formulate your database query based on the information sent to the server. Firebug or something similar will be very helpful in seeing what data is sent to the server based on the alterations you make to the table.
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    There are a number of example server-side processing scripts here: http://datatables.net/development/server-side/ - including a JSP one, if that is of any use.

    Allan
This discussion has been closed.