struts2與jfeechart整合相關問題

2021-08-30 13:00:31 字數 1021 閱讀 3852

[color=red]1:struts2版本低,它的struts-jfreechart-plugin.jar中檔案struts-plugin.xml中定義的包沒有繼承struts-default

[/color]原始檔如下:

150200

解決辦法:解壓jar檔案,將struts-plugin.xml改為

150200

然後用jar命令打包;[color=red]注意:在開發工具中不可直接修改[/color]

[color=red]2.action編寫問題[/color]

①action中必許宣告private jfreechart chart,及getter方法,欄位名必須chart

②亂碼問題,建議將出現漢字的地方(plot,legend,xaxis,yaxis)設定為系統漢字字型,具體**見檔案,setticklabelfont才是設定x軸字型的方法,

③不能將取出資料的加進資料集的方法寫成:

for(string interest : interests)

而是

data.addvalue((integer) context.get("football"), "足球", "足球");

data.addvalue((integer) context.get("volleyball"), "排球", "排球");

data.addvalue((integer) context.get("basketball"), "籃球", "籃球");

data.addvalue((integer) context.get("badminton"), "羽毛球", "羽毛球");

因為:不是每次取出的資料都有四個字段,這樣就導致了最終形成的圖表有的是三列,四列等

3.標籤的用法,卡以檢視相關文件,出現錯誤時,要仔細檢視

Struts2字尾 深入Struts2

一 將action字尾變成html字尾 xmlversion 1.0 encoding utf 8 doctype struts public apache software foundation dtd struts configuration 2.1 en struts include file...

Struts2入門(一)Struts2簡介

本章簡要介紹一下struts2框架 1.概念 我們知道,springmvc框架是為了整合servlet設計的控制層框架,那麼還有其他的框架也實現了這個功能,那麼就是struts2。struts2是乙個基於mvc設計模式的web應用框架,它本質上相當於乙個servlet,在mvc設計模式中,strut...

Struts2與JQurey ajax配合跨域請求

ajax ajax datatype jsonp jsonp callback type post error function data success function data 其中 datatype指定為jsonp,jsonp 指定為 callback 隨意 然後看struts2的配置 ca...