While developing a basic Web Application using NetBeans, I encountered an issue with accessing an image. No matter where I placed the image in the directory structure, it remained inaccessible unless it was in the same location as my index.xhtml file.
I attempted to store "myimage.jpg" within the webapp folder, as well as inside a resources folder and an image subfolder.
Here's what displayed successfully:
<img src="myimage.jpg"/>
However, these images did not display:
<img src="resources/myimage.jpg"/>
<img src="resources/images/myimage.jpg"/>
Interestingly, when I manually entered the URL in the browser after deploying the application:
(payara server url)*/title/myimage.jpg
The image was visible, but trying the following URLs resulted in an "HTTP Status 404 - Not Found" error:
(payara server url)*/title/resources/myimage.jpg
(payara server url)*/title/resources/images/myimage.jpg
I also experimented with various paths such as /, ./, ../, //, but none of them resolved the issue.