锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲AV无码久久久久网站蜜桃,亚洲日韩久久综合中文字幕,亚洲天天在线日亚洲洲精http://m.tkk7.com/javaora/category/9825.htmlzh-cnTue, 27 Feb 2007 18:25:47 GMTTue, 27 Feb 2007 18:25:47 GMT60JFreechartResulthttp://m.tkk7.com/javaora/archive/2006/04/11/40420.htmljava涓栫晫鐣呰皥java涓栫晫鐣呰皥Tue, 11 Apr 2006 03:55:00 GMThttp://m.tkk7.com/javaora/archive/2006/04/11/40420.htmlhttp://m.tkk7.com/javaora/comments/40420.htmlhttp://m.tkk7.com/javaora/archive/2006/04/11/40420.html#Feedback0http://m.tkk7.com/javaora/comments/commentRss/40420.htmlhttp://m.tkk7.com/javaora/services/trackbacks/40420.html Intro

I am rendering a chart to the output stream. Instead of streaming it directly to the response.out, I create a ChartResult , and let webwork do the chaining for me.

I generate the chart in one class, and I render it out in another class, efftectively decoupling the view from the actions. You can easily render it out to file or some view other than a web response.out if you wish.

Configuration
xwork.xml -result-types definitions
<result-types>
聽聽 <result-type name="chart" class="myapp.webwork.extensions.chartResult"/>
</result-types>
xwork.xml -action definitions
<action name="viewModerationChart" class="myapp.webwork.actions.ViewModerationChartAction">
聽聽 <result name="success" type="chart">
聽聽聽聽聽 <param name="width">400</param>
聽聽聽聽聽 <param name="height">300</param>
聽聽 </result>
</action>

Source Codes
My result class search for a "chart" in the ValueStack and renders it out...

public class ChartResult implements聽 Result{
聽聽 private int width;
聽聽 private int height;
聽聽 public void execute(ActionInvocation invocation)throws Exception{
聽聽聽聽聽聽 JFreeChart chart = (JFreeChart)invocation.getStack().findValue("chart");
聽聽聽聽聽聽 HttpServeletResponse response = ServeletActionContext.getResponse();
聽聽聽聽聽聽 OutputStream os = response.getOutputStream();
聽聽聽聽聽聽 ChartUtilities.writeChartAsPNG(os,chart,width,height);
聽聽聽聽聽聽 os.flush();
聽聽 }
聽聽聽聽聽
聽聽 public void setHeight(int height){
聽聽聽聽 this.height=height;
聽聽 }
聽聽
聽聽 public void setWidth(int width){
聽聽聽聽 this.width=width;
聽聽 }
}

public class ViewModerationChartAction extends ActionSupport{
聽聽 private JFreeChart chart;
聽聽
聽聽 public String execute() throws Exception{
聽聽聽聽聽 //chart creation logic ...
聽聽聽聽聽 XYSeries dataSeries = new XYSeries(new Integer(1));
聽聽聽聽聽 for(int i=0;i<=100;i++){
聽聽聽聽聽聽聽聽 dataSeries.add(i,RandomUtils.nextInt());
聽聽聽聽聽 }
聽聽聽聽聽
聽聽聽聽聽 XYSeriesCollection xyDataset = new XYSeriesCollection(dataSeries);
聽聽聽聽聽 ValueAxis xAxis = new NumberAxis("Raw Marks");
聽聽聽聽聽 ValueAxis yAxis = new NumberXxis("Moderated Marks");
聽聽聽聽聽
聽聽聽聽聽 chart = new JFreeChart(
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "Moderation Function",
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 JFreeChart.DEFAULT_TITLE_FONT,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 new XYPlot(
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 xyDataset,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 xAxis,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 yXis,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 new
聽聽聽聽聽聽聽聽聽聽 StandardXYItemRenderer(StandardXYItemRender.LINES),
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 false聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 );
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 ...
聽聽聽聽聽 )
聽聽 }
聽聽
聽聽 public JFreeChart getChart(){
聽聽聽聽聽 return chart;
聽聽 }
}



]]>
主站蜘蛛池模板: 四虎免费在线观看| 免费A级毛片无码专区| 在线播放免费播放av片| 亚洲精品亚洲人成在线麻豆| 人妻无码一区二区三区免费| 国产精品亚洲а∨无码播放| 99久久国产精品免费一区二区| 亚洲精品白浆高清久久久久久| a毛片免费播放全部完整| 亚洲精品无码永久在线观看你懂的| 日韩大片免费观看视频播放| 亚洲美日韩Av中文字幕无码久久久妻妇 | 亚洲免费日韩无码系列| 一区二区免费电影| 一本色道久久综合亚洲精品高清| 在线免费观看污网站| 亚洲AV无码片一区二区三区| 日本牲交大片免费观看| 人妻无码中文字幕免费视频蜜桃| 不卡一卡二卡三亚洲| 亚洲免费视频网站| 亚洲成a人片在线观看中文app| 四虎永久在线精品免费网址| 美女被免费视频网站a| 伊人久久综在合线亚洲91| 免费看一区二区三区四区| 久久亚洲AV无码精品色午夜麻豆| 国产精品永久免费10000| 小说区亚洲自拍另类| 亚洲国产精品尤物yw在线| 99在线免费视频| 亚洲人成片在线观看| 免费少妇a级毛片| 久久国产精品萌白酱免费| 精品丝袜国产自在线拍亚洲| 又粗又硬又黄又爽的免费视频 | 麻豆91免费视频| 亚洲人成在线观看| 真实乱视频国产免费观看| 久久国产精品免费一区| 亚洲人色大成年网站在线观看|