title: Spring cannot get draw, start and length from DataTables
body: <p>I know I am doing something wrong, but I can't find where. If you could look at my code, and tell me, why these parameters are null. I am trying to apply serverside pagination to my app and in DataTables. System.outs didn't work, so my "request" is wrong or these parameters are null. </p>
  
  <p>Maybe someone has useful links for articles about pagination etc? Manual from datatables didn't help me.</p>
  
  <p>Spring Controller:</p>
  
  <pre><code>package com.example.controller;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.RestController;
  
  import com.example.dao.SeriaDao;
  import com.example.model.Seria;
  
  
  @RestController
  public class WebController extends HttpServlet{
  
      @Autowired
      SeriaDao sed;
  
  
      @GetMapping("/tabelka")
      public List&lt;Seria&gt; showTable()
      {
          return sed.findAll();
      }
  
      int draw = 0;
      int start = 0;
      int length = 20;
  
      @GetMapping("/pgTabelka")
      public Map&lt;String,Object&gt; pgTable(HttpServletRequest request)
      {
  
          Map&lt;String,Object&gt; json = new HashMap&lt;String,Object&gt;();
          if(request.getParameter("draw")!=null)
          {
              draw = Integer.parseInt(request.getParameter("draw"));
              System.out.println("draw dziala");
          }
          if(request.getParameter("start")!=null)
          {
              start = Integer.parseInt(request.getParameter("start"));
              System.out.println("start dziala");
          }
          if(request.getParameter("length")!=null)
          {
              length = Integer.parseInt(request.getParameter("length"));
              System.out.println("length dziala");
          }
          int totalRecords = sed.recordsTotal();
  
          List&lt;Seria&gt; serie = sed.findPart(start, length);
  
              json.put("draw", draw);
              json.put("recordsTotal", totalRecords);
              json.put("recordsFiltered", totalRecords);
              json.put("data", serie);
  
  
          return json;
      }
  }
  </code></pre>
  
  <p>Html index: </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head&gt;
      &lt;title&gt;Data Viewer&lt;/title&gt;
      &lt;script
                src="https://code.jquery.com/jquery-3.3.1.js"
                integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
                crossorigin="anonymous"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.18/datatables.min.css"/&gt;
  
      &lt;script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.18/datatables.min.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;table id="tab" class="display"&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;id&lt;/th&gt;
          &lt;th&gt;name&lt;/th&gt;
          &lt;th&gt;file&lt;/th&gt;
          &lt;th&gt;cassid&lt;/th&gt;
          &lt;th&gt;categoryid&lt;/th&gt;
          &lt;th&gt;datefrom&lt;/th&gt;
          &lt;th&gt;frequency&lt;/th&gt;
          &lt;th&gt;markers&lt;/th&gt;
          &lt;th&gt;unit&lt;/th&gt;
          &lt;th&gt;feed&lt;/th&gt;
          &lt;th&gt;userid&lt;/th&gt;
          &lt;th&gt;createdate&lt;/th&gt;
          &lt;th&gt;changedate&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;/table&gt;
  &lt;script&gt;
      $('#tab').DataTable( {
  
          ajax: {
              processing: true,
              serverSide: true,
              url: '/pgTabelka',
          },
          columns: [
              {data: "id"},
              {data:"name"},
              {data:"file"},
              {data:"cassid"},
              {data:"categoryid"},
              {data:"datefrom"},
              {data:"frequency"},
              {data:"markers"},
              {data:"unit"},
              {data:"feed"},
              {data:"userid"},
              {data:"createdate"},
              {data:"changedate"}
          ]
      } );
  
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>JSON from Postman(shorted):</p>
  
  <pre><code>{
  "recordsFiltered": 488,
  "data": [
  {
  "id": 41,
  "name": "Average Weekly Earnings of All Employees: Total Private in Corpus Christi, TX (MSA)",
  "file": "SMU48185800500000011.csv",
  "cassid": "1d2e556b-031e-4c6f-aec4-981c4e907324",
  "categoryid": 3,
  "datefrom": "2006-12-31",
  "frequency": 5,
  "markers": null,
  "unit": "$ per Week",
  "feed": "Macroeconomic_And_Major_Markets",
  "userid": null,
  "createdate": "2016-10-15T23:38:49",
  "changedate": "2017-01-09T00:50:01"
  },
  {
  "id": 42,
  "name": "Harmonized Index of Consumer Prices: Audio-Visual, Photographic, and Information Processing Equipment for Cyprus",
  "file": "CP0910CYM086NEST.csv",
  "cassid": "6df5b8d5-ec39-4860-930f-a8b355cce37a",
  "categoryid": 3,
  "datefrom": "1995-12-31",
  "frequency": 5,
  "markers": null,
  "unit": "Index 2015=100",
  "feed": "Macroeconomic_And_Major_Markets",
  "userid": null,
  "createdate": "2016-10-15T23:38:49",
  "changedate": "2017-02-16T11:35:04"
  },
  {
  ........
  }
  ],
  "draw": 0,
  "recordsTotal": 488
  }
  </code></pre>