I'm working on a spring boot project with thymeleaf and I need to create a file and put some lines on it then send it for the user to download it.
@PostMapping("/filegenerator")
public String createFile(@ModelAttribute("page") Page page, Model model) {
List<String> lines = new ArrayList<String>();
//Some code ..........
lines.forEach(l->{
System.out.println(l);
});
//Here I need to create a file with the List of lines
//And also put some code to download it
return "filegenerator";
}