Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Server side processing for DataTables in Java
Java Groovy Shell
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Server side processing for datatables.

How to make basic setup?

Setup html table somewhere in JSP for instance:

    <table id="example">
      <tbody> </tbody>

Setup your datatable with bServerSide and sAjaxSource options:

    $(document).ready(function() {
            "aoColumns": [
              {sName: "engine"},
              {sName: "browser"},
              {sName: "version"},
              {sName: "platform"},
              {sName: "grade"} ],
            "bServerSide": true,
            "sAjaxSource": "ExampleServlet"

Keep in mind that sName values must exactly match column names set in object of ServerSideDataTable class (

Add ExampleServlet mappings to web.xml:



Create to handle datatable POST action:

    public class HelloServlet extends HttpServlet {

        private static ServerSideDataTable dataTable =

        public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
                IOException {
            List<ExampleRow> rows = DataSource.loadAll();

            DataTablesRequest dataTablesRequest = new DataTablesRequest(req.getParameterMap(), dataTable);
            DataTablesResponse dataTablesResponse = dataTablesRequest.process(rows);


In this case datatables-ss uses reflection to get values. Objects of class ExampleRow are simple POJOs with getEngine, getBrowser getters. In next section you'll see how to make more customized configuration.

ServerSideDataTable configuration

Column types

datatables-ss supports couple of column types out of box:

  • text
  • numeric
  • date
  • bool

There's also one special column type id. It auto-generates index value when table is being displayed on screen. All column definitions require column name parameter which corresponds to getter method in model object:
            .id("id") // getId()
            .text("text") // getText()
            .numeric("numeric") // getNumeric()
            .date("date") // getDate()
            .bool("bool") // getBool()

Value accessors

Reflection is not the only way how datatables-ss can access data. You may also define specific ValueAccessor for cases when your object has no valid bean getter etc.

    .column("size").accessibleWith(new ValueAccessor() {
      public Object getValueFrom(Object model) {
        return ((ExampleRow) model).size();

Custom column types

    .column("").withType(new Type() {
      public int compare(Object o1, Object o2) {
        return 0;

Display converters

    .column("").displayedWith(new DisplayConverter() {
      public String convert(Object arg) {
        return arg == null ? "none" : arg.toString();

Sorting by model/display


... t.b.c ...

Something went wrong with that request. Please try again.