<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

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


    網站導航:
     
    主站蜘蛛池模板: 亚洲欧洲日产v特级毛片| 亚洲熟妇丰满多毛XXXX| 亚洲制服丝袜中文字幕| 99国产精品视频免费观看| 亚洲AV无码专区电影在线观看| japanese色国产在线看免费| 久久国产成人精品国产成人亚洲| 亚欧乱色国产精品免费视频| 亚洲毛片av日韩av无码| 久久国产乱子伦精品免费午夜| 亚洲欧洲日产国码av系列天堂| 国产一级婬片A视频免费观看| 亚洲av永久无码精品秋霞电影影院| 免费在线观影网站| 91亚洲va在线天线va天堂va国产 | 日本一道本高清免费| 国产精品亚洲av色欲三区| 免费a级毛片大学生免费观看 | 中文字幕在线亚洲精品| 久久国产精品成人免费| 337p日本欧洲亚洲大胆艺术| 久久久高清免费视频| 激情婷婷成人亚洲综合| 久久精品国产亚洲一区二区| 免费毛片a线观看| 国产精品亚洲片夜色在线 | 国产亚洲综合网曝门系列| 99在线观看视频免费| 成人亚洲国产va天堂| 国产人妖ts在线观看免费视频| 精品一区二区三区免费观看| 亚洲精品福利视频| 日美韩电影免费看| 免费看黄的成人APP| 久久久久久亚洲精品影院| 亚洲国产主播精品极品网红| 67194成手机免费观看| 国产亚洲视频在线播放大全| 亚洲精品成人av在线| www.亚洲色图.com| 1000部啪啪毛片免费看|