0 Replies Latest reply on Jun 23, 2011 1:16 PM by Benniu Ji

    problem to use mediaOutPut to show a JFreeChart

    Benniu Ji Newbie

      This question is both related to Seam and Richfaces. I'm not sure which fourm should I post this question on so I just posted on both.


      I'm using Seam 3 and Richifaces 4


      I have on page named 'report.jsf'. It has a parameter 'id'.

      The url is like:   report.jsf?id=123



      On the page, there is a view action


      <s:viewAction action="reportManager.loadReport" />



      This method will fetch report from DB according to the id.

      Also on this page, I used


      <a4j:mediaOutput element="img" cacheable="false" session="false"



                       createContent="#{reportManger.paint}" value="#{mediaData}"



                       mimeType="image/jpeg" />



      to display a JFreeChart. The paint method will dynamically create a chart according to the report info got from DB.



      In loadReport method it will get data from DB which will be used by paint method.



      Here is the problem:



      The report page displays the report info correctly but the chart does not. The chart is always empty.



      I guess reportManager.paint is called before loadReport fetches the data to generate the chart.



      How to lodaReport firstly and then paint the chart?



      Can anyone show me an example which uses a view action to load data and dynamically generate a JFreechart and display in medialOutPut?