I am trying to use absolute path of my image while using it with jquery like this but somehow it is not loading any image once I see my page. Below is my code in testing.jsp file
<script>
$(document).ready(function(){
// Create overlay and append to body:
$('<div id="overlay"/>').css({
position: 'fixed',
top: 0,
left: 0,
width: '100%',
height: $(window).height() + 'px',
opacity:0.4,
background: 'lightgray url("/testweb/src/main/webapp/resources/img/page-loader.gif") no-repeat center'
}).hide().appendTo('body');
// Execute refresh with interval:
setInterval(refresh, 30 * 1000);
});
</script>
Directory structure is like this -
webapp/
|-- resources/
| +-- img/
| page-loader.gif
+- WEB-INF/
+-- views/
testing.jsp
Is there anything wrong I am doing here?
/resources/img/page-loader.gif/resources/img/...insteadtestwebin my case and then you put your image in img directory which is in webapp folder. So when I right click my image and I click Copy Qualified Name in my eclipse, it gives me the full path as I provided in the question.http://127.0.0.1:8080/testweb/testing