I'm working on a Spring Boot web application, and have the main page which has a dropdown box of files, and a button which reads each in.
When they are read in, it redirects to a page where the data is displayed. But when I refresh the page or go back to home, then read it again, the array storing the file data gets added onto, which is then displayed each time. How can I fix this?
@RequestMapping(value = "cnfgRead", method = RequestMethod.GET)
public String readCNFG(Model model, @RequestParam String cnfgListId) {
ReadCNFG readCNFG = new ReadCNFG();
//Reads in data from specified file using param
ReadCNFG.readCNFG(cnfgFile + cnfgListId);
model.addAttribute("Array", readCNFG.getOrigFitLines());
return "cnfgView";
}
Or Do I need to put the array back to empty somehow before the data is read in within the controller?