@RequestMapping(value = "/export", produces = "text/csv")
public String csv(@DatatablesParams DatatablesCriterias criterias, HttpServletRequest request,
List<Person> persons = personService.findPersonsWithDatatablesCriterias(criterias).getRows();
ExportConf exportCsvConf = new ExportConf.Builder(ReservedFormat.CSV)
.header(true)
.exportClass(new CsvExport())
.build();
HtmlTable table = new HtmlTableBuilder<Person>().newBuilder("tableId", persons, request, exportCsvConf)
.column().fillFromCriteria(criterias).title("Id") (1)
.column().fillFromCriteria(criterias).title("Firtname")
.column().fillFromCriteria(criterias).title("Lastname")
.column().fillFromCriteria(criterias).title("City")
.column().fillFromCriteria(criterias).title("Mail")
.column().fillFromCriteria(criterias, "{0,date,dd-MM-yyyy}").title("BirthDate") (2)
.build();
ExportUtils.renderExport(table, exportCsvConf, response);
}