【发布时间】:2022-01-16 12:05:09
【问题描述】:
我正在 Spring Boot 中制作房地产应用程序 - thymeleaf,我真的需要问你如何存储图像。我正在考虑为图像制作一个表格并将其注释为 manyToOne,并将其插入到属性实体中,因为一个属性可以有 10、15、20 个图像,这就是我知道该怎么做的部分。
但我不确定如何处理其余代码。如何在 /add 方法中进行文件上传? 以及如何在 thymeleaf 中添加和显示它们?
这是我的 /properties/add 方法,没有插入图像的选项:
@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";
}
我不希望你输入它,但也许有人知道最相似的项目
【问题讨论】:
标签: spring-boot file-upload spring-data-jpa image-upload spring-data-jpa-datatables