0

まず、ここ ( http://code.google.com/p/struts2-examples/downloads/listと Hello_World_Struts2_Mvn.zip をダウンロード) にアクセスし、その例を実行します。

その後、ここ ( http://struts.apache.org/2.x/docs/jfreechart-plugin.html ) に移動し、 commons-lang-2.5.jarjcommon-1.0.16.jarの依存関係を追加し ます。およびjfreechart-1.0.13.jarを使用し、code.google.com からダウンロードしたサンプルを変更してJFreeChartの動作を確認しましたが、次のエラーが表示されます。

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

struts.xml の 36 行目には、このコード (struts2 Web サイトのコード) があります。

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

私が間違っていることは何ですか?

4

1 に答える 1

0

プロジェクトの struts.xml を Jfreechart 関連のアクションで変更し、別のパッケージで定義する必要があります。たとえば。

<package name="struts2" extends="jfreechart-default">  
<action name="viewModerationChart" class="myapp.actions.ViewModerationChartAction">
  <result name="success" type="chart">
    <param name="width">400</param>
    <param name="height">300</param> 
  </result>
</action>
</package>  
于 2010-09-10T11:24:27.183 に答える