Reputation: 131
After creating some sub folders under WEB-INF like js or images,i found problems loading their files i can not obtain any js or image files...what it could be the problem?. I got this error on the browser :
GET http://localhost:8080/images/blueAqua.gif 404 (Not Found)
Upvotes: 0
Views: 1086
Reputation: 1
Try this:
<servlet-name>default</servlet-name>
<url-pattern>*.gif</url-pattern>
</servlet-mapping>
Upvotes: 0
Reputation: 131
It work fines now i did realise what was the problem and how to fix it, it needed just some configuration in the web.xml as below:
<servlet-name>default</servlet-name>
<url-pattern>/static/*</url-pattern>
</servlet-mapping>
and in the JSP file it was the call like this :
<body background="static/images/example.jpg">
thx for your help anyway.
Upvotes: 0
Reputation: 48817
WEB-INF
is not accessible client-side.
I usually create a static
folder next to the WEB-INF
one, to store images, JS, CSS, etc.
webapp
|__static
| |__css
| |__js
| |__img
|__WEB-INF
|__web.xml
Then, access the resources using:
http://localhost:8080/static/images/blueAqua.gif
Upvotes: 1