1 Reply Latest reply on Jun 23, 2011 2:31 PM by lightguard

    Unable to display a JFreeChart

    lsqfjbn

      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?