<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世界暢談 閱讀(315) 評論(0)  編輯  收藏 所屬分類: WEBWORK

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


    網站導航:
     
    主站蜘蛛池模板: 日韩特黄特色大片免费视频| 久久亚洲精品成人无码网站| 亚洲AV伊人久久青青草原| 羞羞漫画小舞被黄漫免费| 中文字幕无码日韩专区免费| 成年女人免费视频播放77777| 亚洲w码欧洲s码免费| 国产18禁黄网站免费观看| 亚洲人成小说网站色| 四虎一区二区成人免费影院网址| 久草福利资源网站免费| 中文字幕亚洲一区二区三区| 国产精品偷伦视频免费观看了 | 国产免费人视频在线观看免费| 精品多毛少妇人妻AV免费久久 | 亚洲网址在线观看你懂的| a级毛片毛片免费观看久潮| 中文亚洲AV片在线观看不卡| 成人无码WWW免费视频| 亚洲中文精品久久久久久不卡| 成人毛片免费观看视频大全| 国产做国产爱免费视频| 亚洲av无码成人精品区一本二本 | eeuss草民免费| 亚洲成人激情小说| 色播亚洲视频在线观看| 国内精品乱码卡1卡2卡3免费| 最新亚洲卡一卡二卡三新区| 亚洲中文字幕无码一区| 日韩免费观看的一级毛片| 久久精品国产免费观看| 精品国产免费一区二区三区香蕉 | 亚洲精品自拍视频| 永久黄网站色视频免费直播| 成年大片免费高清在线看黄| 亚洲av无码不卡久久| 免费一级肉体全黄毛片| 免费观看91视频| caoporn国产精品免费| 综合偷自拍亚洲乱中文字幕| 亚洲精品夜夜夜妓女网|