tags:

views:

73

answers:

1

i am using - and new to - GWT and i made an Image Widget to view an image. This image is found on my file system i wrote.

String src = "file:///D:/myfolder/myfile.jpg";
Image image = new Image();
image.setUrl(src);

but image doesn't appear!

A: 

You should specify either the whole URL (http://www.example.com/img/myfile.jpg) or (better yet) just relative to the root: /img/myfile.jpg. And, of course, you have to place your images in your WAR directory.

That's the simple setup. If you have more images and want to optimize fetching them (many images -> many requests to the server), have a look at the ClientBundle.

Igor Klimer