How to use Struts 2 with JFreeChart?

Posted by Pere on Stack Overflow See other posts from Stack Overflow or by Pere
Published on 2010-04-08T14:22:53Z Indexed on 2010/04/08 15:33 UTC
Read the original article Hit count: 337

Filed under:
|

Firstly, I went here ( http://code.google.com/p/struts2-examples/downloads/list and I downloaded Hello_World_Struts2_Mvn.zip) and I run that example.

After that, I went here (http://struts.apache.org/2.x/docs/jfreechart-plugin.html), I add the dependencies for commons-lang-2.5.jar, jcommon-1.0.16.jar and jfreechart-1.0.13.jar and I modify the example downloaded from code.google.com to see how JFreeChart is working, but I receive this error:

Unable to load configuration. - action - file:/C:/.../untitled_war_exploded/WEB-INF/classes/struts.xml:34:67

Caused by: Error building results for action createChart in namespace  - action - file:/C:/.../out/artifacts/untitled_war_exploded/WEB-INF/classes/struts.xml:34:67

Caused by: There is no result type defined for type 'chart' mapped with name 'success'.  Did you mean 'chart'? - result - file:/C:/.../out/artifacts/untitled_war_exploded/WEB-INF/classes/struts.xml:36:49

At the line 36 in struts.xml is the this code (the code from struts2 website):

<action name="viewModerationChart" class="myapp.actions.ViewModerationChartAction">
  <result name="success" type="chart">
    <param name="width">400</param>
    <param name="height">300</param> 
  </result>
</action>

What I'm doing wrong?

© Stack Overflow or respective owner

Related posts about struts2

Related posts about jfreechart