Hello,
What I want to do, is to generate a css in my document, with link to a couple of database stored images.
In the init() of my page bean, I have
for(Category c : (List<Category>)getSessionBean1().getCategoryListDataProvider().getList()) {
pageStyle += "div.categoryLabel_"+c.getId()+" {";
if(c.getColor() != null)
pageStyle += "background-color:"+c.getColor();
if(c.getIconMimeType() != null) {
MediaOutput out = new MediaOutput();
out.setValue(c.getId());
out.setMimeType(c.getIconMimeType());
out.setCacheable(false);
out.setSession(true);
out.setElement("img");
out.setCreateContent(getFacesContext().getApplication().createMethodBinding("#{SessionBean1.paintCategoryIcon}", null));
pageStyle += "background:url("+out.getUriAttribute()+") no-repeat top;";
}
pageStyle += "}\n";
}
But, getUriAttribute is null, what I totaly understand, because the component has not yet been rendered.
But, I don't know what is the correct way to achieve this.
the SessionBean1.paintCategoryIcon method works, and I have some a4j:mediaOutput component (created in jsp) in another page which works well.
Best Regards
Kuon