Use non Vaadin images in my application


I have problem with using my own images in Vaadin application. I use maven to build project and simple do not get where I should put my images and how to get access to it in application.

PS. right now I put all images to “src\main\webapp\images”, but still can use it like ExternalRecourse.

Thank for your advice.

If you have the images on your classpath, you can access them using ClassResource (IIRC). ExternalResource is only usable for URL addressed.

You can use ExternalResource(“your_app_name/images…”)


Thank for your reply, but this still do not solve my problem. As I understand Vaadin try to search images in his own packages, but not in my WEB-APP folder, because all Vaadin packages connected to my project like external resource.

If you use ExternalResource to look for images, they either have to be under the ROOT context or, if under the application, the actual application servlet must me mapped to something else than /* in web.xml. For example, if the application name is “foo”, you should map the servlet to /app/. You can then access it with". When you add images in the application, say under “images” directory under the WebContent, you can access them by, etc. Also remember to map "/VAADIN/" to the servlet.

See for example
this demo