Samurai Soul
Samurai Soul

Reputation: 245

In a GWT UiBinder template with an image resource, where should I locate the actual image file?

According to the docs, you can add an image resource to be used in a uibinder template like this:

public interface Resources extends ClientBundle {

  @Source("Logo.jpg")
  ImageResource logo();

  ...
}

Using this example as is, however, the image file (Logo.jpg) must be included in the same directory/package as Resources.java. Where should I put my image file and how should I list the file path so that I don't have to keep the image file in my src tree? Specifically, I'm using maven - don't I want my images in src/main/webapp, not in src/main/java/com/mygwtapp/client?

Upvotes: 1

Views: 911

Answers (1)

Ioan Agopian
Ioan Agopian

Reputation: 788

You can provide a relative path for your images like this:

@Source("../../resources/images/Logo.jpg")
ImageResource logo();

The path is relative to where your Resources interface is located. And ../ stands for parent directory.

Upvotes: 2

Related Questions