h1072907909 2011-05-09 10:01
浏览 185
已采纳

RemoteObject在同一页面发送两次后台请求返回值处理

项目是用的flex3+Spring3+hibernate3.6+blazeds,全用注解写的,在同一页面发送两次后台请求,总是报[RPC Fault faultString="java.lang.StackOverflowError : null" faultCode="Server.Processing" faultDetail="null"]错误,代码如下:
[code="java"]<?xml version="1.0" encoding="utf-8"?>
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
allowClose="true" title="部门管理区" allowDrag="true" allowMaximize="true"
allowMinimize="true" resizeEffect="Resize" moveEffect="Move" horizontalScrollPolicy="off"
verticalScrollPolicy="off" [color=red]creationComplete="getAllDepartment()"[/color]>

<mx:AMFChannel id="myamf"
                   url="http://localhost:8080/MyFlexOA/messagebroker/amf"/>
<mx:ChannelSet id="channelSet"
               channels="{[myamf]}"/>
<mx:RemoteObject id="departmentService"
                 destination="departmentService"
                 channelSet="{channelSet}"/>
<mx:RemoteObject id="departmentServiceDel"
                 destination="departmentService"
                 channelSet="{channelSet}" />

<mx:Script>
    <![CDATA[
        import mx.rpc.AsyncToken;
        import mx.events.ListEvent;
        import mx.events.ItemClickEvent;
        import cn.edu.hyit.oa.event.DepartmentEvent;
        import mx.events.CloseEvent;
        import components.AddDepartment;
        import mx.rpc.events.ResultEvent;
        import mx.collections.ArrayCollection;
        import cn.edu.hyit.oa.vo.DepartmentVo;
        import mx.controls.Alert;
        import mx.managers.PopUpManager;
        import flash.events.ContextMenuEvent;



        [Bindable]
        public var departmentList:ArrayCollection;

        private var addDepartmentView:AddDepartment;

        private function getAllDepartment():void {
            var menuItem:ContextMenuItem = new ContextMenuItem("删除");
            var menuItem2:ContextMenuItem = new ContextMenuItem("保存更新");
            menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,deleteHandler);
            //menuItem2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,updateHandler);
            var menu:ContextMenu = new ContextMenu();
            menu.hideBuiltInItems();
            menu.customItems.push(menuItem);
            menu.customItems.push(menuItem2);
            this.contextMenu = menu;
            [color=red]departmentService.addEventListener(ResultEvent.RESULT, resultHandler);
            departmentService.loadAllDepartments();[/color]
        }

        private function deleteHandler(e:ContextMenuEvent):void
        {
            [color=red]departmentServiceDel.addEventListener(ResultEvent.RESULT, delResultHandler);
            var d:DepartmentVo = de.selectedItem as DepartmentVo;
            departmentServiceDel.delDep(d);[/color]
        }


        private function resultHandler(e:ResultEvent):void {
            departmentList = e.result as ArrayCollection;
        }

        private function delResultHandler(e:ResultEvent):void {
            departmentList.removeItemAt(de.selectedIndex);
        }[/code]
  • 写回答

7条回答 默认 最新

  • cbcgkx 2011-05-09 11:35
    关注

    既然你都已经获得了result了 你可以绑定一个数据源 把result赋给那个数据源 数据源发生了变化 页面上的内容 会自动变化的

    有很多方式可以显示result的值 关键是只要你获得了页面控件的引用后 你就可以为所欲为

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

悬赏问题

  • ¥15 elasticsearch
  • ¥30 python ttk 获取下拉框问题
  • ¥15 uniapp的uni-datetime-picker组件在ios端不适配
  • ¥15 前端 uniapp App端在离线状态如何使用modbus 连接手机蓝牙进行读写操控机器?
  • ¥15 SQL语句根据字段自动生成行
  • ¥500 “掌声响起来”软件(不确定性人工智能)
  • ¥500 我要找大模型一体机产品手册和应用案例
  • ¥20 关于游戏c++语言代码问题
  • ¥15 如何制作永久二维码,最好是微信也可以扫开的。(相关搜索:管理系统)
  • ¥15 delphi indy cookie 有效期