Truy cập vào link sau để tải file csv download csv
BufferedReader br = new BufferedReader(new InputStreamReader(f.getInputStream(), StandardCharsets.UTF_8));
String line;
while ((line = br.readLine()) != null) {
line = br.readLine();
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date date = formatter.parse("2024-11-25");
final Pattern csvPattern = Pattern.compile(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
String str = "name,\"John, Doe\",age,\"30\",city,\"New York\"";
String[] arr = csvPattern.split(str);
<td th:text="${#dates.format(o.date, 'dd/MM/yyyy')}"></td>
<ul>
<li th:each="i: ${#numbers.sequence(1, 10)}">
<a th:href="@{/customer?page={page}(page=${i})}" th:text="${i}"></a>
</li>
</ul>
public interface CustomerRepository extends PagingAndSortingRepository<Customer, String>, CrudRepository<Customer, String>{
}
@GetMapping("/customer/{page}")
public String index(Model model, @PathVariable int page){
Pageable pageable = PageRequest.of(page, PageSize);
Iterable list = customerRepository.findAll(pageable);
model.addAttribute("list", list);
return "customer/index";
}