I'm making a real estate app in spring boot - thymeleaf and I really need to ask you how to store images. I was thinking about making a table just for images and anotate it manyToOne, and insert it into Property entity because one property can have 10,15,20 images and that is the part I know how to do.
But I'm not sure how to handle the rest of the code. How to make file upload in the /add method? And also howadd and show them in thymeleaf?
This is my /properties/add method without the option of inserting images:
@RequestMapping("/add")
public String add(Model theModel) {
Property theProperty = new Property();
User theUser = new User();
theProperty.setUser(theUser);
List<User> userList = userService.findAll();
Address theAddress = new Address();
theProperty.setAddress(theAddress);
List<Address> addressList = addressService.findAll();
theModel.addAttribute("property", theProperty);
theModel.addAttribute("user", userList);
theModel.addAttribute("address", addressList);
return "properties/property-form";
}
I don't expect you to type it but maybe somebody know the most similar project