-1

I have an object call product, inside of this i have an atribute call img, where i have the name of the img for example "gtav.jpg"

please click the links to see the images

Also there is my repository: https://github.com/Bryanzdruls/EcommerceSpringBoot/tree/master

I've tried to show the img and image of the error 404

This is my mysql table

Image of the product table

this is my template (using thymeleaf) image of the template

also i have this structure proyect

As i know using thymeleaf is enough to put "th:src="@{images/(name Of the img)}"" but i dont know why is not working.

Pd: if i try to navigate using my browser to localhost:32426/images/gtav.jpg i get also a 404 error whitelabel error

desertnaut
  • 57,590
  • 26
  • 140
  • 166

1 Answers1

0

It would help if you could share more information.

Until then, figuring out the problem can be done by splitting it into smaller pieces and making sure that each of them work.

When you navigate using your browser to localhost:{port}/images/gtav.jpg do you get the image?

If not the problem comes from your resources not being served.

If that works fine next step is checking if thymeleaf plays well with the resources. Have the simplest possible page loading the image. This way you will make sure that there is no typo or mistake in the way you configure or type the thymeleaf aspect.

If that also goes fine, then you can start looking into your object and the replacement of the values in thymeleaf.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • Hello thanks for your answer, if i put localhost:32426/images/gtav.jpg it appears me error 404 and I dont understand why – Sasaki Haise May 26 '23 at 00:04
  • The bean you defined for the security filter chain is blocking. In the SecurityFilterChain bean you have the following line authorizeHttpRequests().requestMatchers("/**").authenticated() which overrides the default behavior with spring boot and thymeleaf and the static files require authentication. – Alexandros Nikoloutsos May 26 '23 at 06:22
  • Thank you man, but still with the problem – Sasaki Haise May 29 '23 at 18:46