wfaler wrote:
Hi,
I want to use a ResourceReference (or something comparable) to set the
background-attribute of a td-cell with an image on my classpath.
How do I achieve this?
It is quite straightforward for images, but it gets trickier with
background-images to other html elements..
If you object to style attributes on your HTML tags, then you can do
this by writing stuff out to the <head> of your page.
private static final ResourceReference IMAGE = /* ... */;
...
final Component component = /* ... */;
page.add(new AbstractBehavior() {
public void renderHead(IHeaderResponse response) {
String url = urlFor(IMAGE);
String foo = "<style>\n";
foo += "#" + component.getMarkupId() + " {\n";
foo += "background-image: url(" + url ")\n;";
foo += "}\n";
foo += </style>";
response.renderString(foo);
}
});
Should work. ;-)
Regards,
Al
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]