Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Image img = new Image("my-img-id") {
	@Override
	protected void onComponentTag(ComponentTag tag) {
		// illustrates how to prevent an image from caching by adding a random value to the src attribute
		// This is similar to the code thats in NonCachingImage and would be the preferable solution for this
		super.onComponentTag(tag);
		String src = (String) tag.getAttributes().get("src");
		src = src + "&rand=" + Math.random();
		tag.getAttributes().put("src", src);
	}
};

...