Hi!
> I want to show a BufferedImage on a JSF-generated page. In my case, this 
> Image is generated by the JFreeChart[1] library. Now my question:
> What must I do, that I can show this image as a graphic on a JSF Page?
>   
Hehe - I had the same problem yesterday.

One solution is the latest tomahawk-sandbox and its graphicsImageDynamic
component.
There you can do something like:

<s:graphicsImageDynamic value="#{backingBean.chartRenderer}" where the
method signature of chartRenderer is

public ImageRenderer getChartRenderer()
{
}

To fulfill the ImageRenderer requirements is easy, just create a png/gif
byte array out of the chart and write it to the ResponseStream where
requested by the ImageRenderer Interface.
The trick is, that you have to find some way to push down informations
to the managed bean.

If you do not use MyFaces Orchestra (or Seam) which provides a
conversation scope, the easiest way is to put the backingBean into the
session scope.


Another way is to use s:graphicsImageDynamic
imageRenderer="#{backingBean.chartImageRenderer}". Then the method
signature of chartImageRenderer is
public String getChartImageRenderer() where you have to provide a FQN of
a class implementing the ImageRenderer interface.
It should work then to add f:param tags within the graphicsImageDynamic
component to pass down some informations to the renderer.
Though, I do not know much more about that way ... I am a MyFaces
Orchestra user ;-)

Ciao,
Mario

Reply via email to