<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Oracle神諭

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      284 隨筆 :: 9 文章 :: 106 評論 :: 0 Trackbacks

    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;
    ?? }
    }

    posted on 2006-04-11 11:55 java世界暢談 閱讀(314) 評論(0)  編輯  收藏 所屬分類: WEBWORK

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 免费高清在线爱做视频| 久久九九全国免费| 女人18一级毛片免费观看| 亚洲成a人不卡在线观看| 亚洲视频在线观看免费视频| 在线观看亚洲一区二区| 24小时在线免费视频| 亚洲成人网在线播放| a毛片基地免费全部视频| 亚洲欧洲日韩极速播放| 大地资源免费更新在线播放| 亚洲成年网站在线观看| 日韩精品免费电影| 美女视频黄a视频全免费网站一区| 免费视频淫片aa毛片| 理论亚洲区美一区二区三区| 亚洲第一页日韩专区| 岛国岛国免费V片在线观看| 亚洲精品国偷自产在线| 无码日韩精品一区二区三区免费 | 亚洲精品视频观看| 免费看污成人午夜网站| 久久久久久亚洲精品无码 | 免费观看理论片毛片| 激情吃奶吻胸免费视频xxxx| 性色av免费观看| 一个人看的免费视频www在线高清动漫 | 91在线精品亚洲一区二区| 亚洲成在人线aⅴ免费毛片| 亚洲爆乳无码专区www| 中文字幕亚洲乱码熟女一区二区 | 中文字幕免费在线看线人 | 中文亚洲AV片不卡在线观看| 国产好大好硬好爽免费不卡| 亚洲天堂免费在线| 亚洲精品无码日韩国产不卡?V | 亚洲国产精品ⅴa在线观看| 亚洲一区二区三区自拍公司| 曰批视频免费40分钟试看天天| 亚洲av无码一区二区三区人妖 | 亚洲AV综合色区无码二区爱AV|