So I am new to spring and want to organize my pictures in a folder like so:
Resources:
Static:
Images:
image.png
CSS:
etc:
(with my images in their own folder in static )
currently I only know how to just put them right into static like this:
@GetMapping("/imgTest")
public String getImageTest(Model model, @RequestParam(
name= "img",
required = false,
defaultValue = "default.png") String imageName){
model.addAttribute("imgName", imageName);
return "imageTest";
}
then my template being:
<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Image test</title>
</head>
<body>
<img th:src="/${imgName}" alt="AAA"/> <!-- for good luck -->
<div>
</div>
</body>
</html>