'Image not displayed in JSP page with springboot

I just started learning springboot. Right now I am design the food order website But I want to put an image from the jsp page but int not showing me on browser.


main
|
|__webapp
    |
    |__WEB-INF
       |
       |__view
          |
          |__index.jsp
          |__images
          |__css

I am trying to add the image from image folder to index.jsp page. in image floder i stored all the images and in css folder i stored all the custom css file.

Index.jsp file

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>JSP-Page</title>
    </head>
    <body>
        <img src="images/top.jpg" alt="food delight">
    </body>
</html> 

I also tried replacing the src as <img src="../../images/top.jpg"> but it didnt work i also tried moving my jsp and image to webapp folder directly also but no use. Is there anything im doing wrong how exactly does spring handle img requests?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source