How to directly make CSS reference to image resources?

67 views
Skip to first unread message

membersound

unread,
Jan 18, 2013, 9:59:17 AM1/18/13
to google-we...@googlegroups.com
How do I have to make reference to images under src/main/resources/icons?

In my css (placed under src/main/webapp):

.my-class {
    background: url("../resources/icons/image.gif)";
}



I'm constantly getting [WARN] 404 - GET /resources/icons/validation_error_icon.gif (127.0.0.1) 1427 bytes.

Wayne Rasmuss

unread,
Jan 20, 2013, 3:54:51 PM1/20/13
to google-we...@googlegroups.com
Assuming your build is including the resource, your image will be under /WEB-INF/classes/resource/icons/image.gif. Generally, you wouldn't access a resource from your classes like that though. You could make a resource servlet that would use the getResourceAsStream facility to load and serve those resources. The conventions seems to be to either just put your image in your webapp folder just like the css, or to use the GWT resource bundle stuff.
Reply all
Reply to author
Forward
0 new messages