zoukankan      html  css  js  c++  java
  • Flex 应用Remote与后台通信

    1.创建模拟Services:(DataRomate.java类中getList()方法遍历数据)
    Java代码 复制代码
    1. public class DataRomate    
    2. {   
    3.     public List getList()   
    4.     {   
    5.         List list = new ArrayList();   
    6.         for(int i=0;i<10; i++)   
    7.         {   
    8.             Map map = new HashMap();   
    9.             map.put("name""name"+i);   
    10.             map.put("description""description"+i);   
    11.             map.put("targeingexpression""targeingexpression"+i);   
    12.             map.put("userdby""userdby"+i);   
    13.             map.put("porfilechart""porfilechart"+i);   
    14.             list.add(map);   
    15.         }   
    16.         return list;  
    public class DataRomate 
    {
    	public List getList()
    	{
    		List list = new ArrayList();
    		for(int i=0;i<10; i++)
    		{
    			Map map = new HashMap();
    			map.put("name", "name"+i);
    			map.put("description", "description"+i);
    			map.put("targeingexpression", "targeingexpression"+i);
    			map.put("userdby", "userdby"+i);
    			map.put("porfilechart", "porfilechart"+i);
    			list.add(map);
    		}
    		return list;
    
    


    2.配置:remoting-config.xml
    Remoting-config.xml代码 复制代码
    1. <destination id="DataRo">   
    2.     <properties>   
    3.         <source>com.test.DataRomate</source>   
    4.     </properties>   
    5. </destination>  


    3.*.mxml获取数据:
       A : getData(event:ResultEvent)方法实现数据绑定
    Flex代码 复制代码
    1.   public function getData(event:ResultEvent):void   
    2.   {   
    3. dataGridId.dataProvider = event.result;   
    4.   }  


       B: 组件设置:
      
    Flex代码 复制代码
    1. <mx:RemoteObject id="DataRo" destination="DataRo" result="getData(event)" />   


       C:设置DataGrid组件:
      
    Flex代码 复制代码
    1.        
    2. <mx:DataGrid id="dataGridId" creationComplete="DataRo.getList()">   
    3.     <mx:columns>   
    4.     <mx:DataGridColumn dataField="name" headerText="Name"/>   
    5.     <mx:DataGridColumn dataField="description" headerText="Description"/>   
    6.            pression"/>   
    7.     <mx:DataGridColumn dataField="userdby" headerText="Used by"/>   
    8.     <mx:DataGridColumn dataField="porfilechart" headerText="Porfile Chart"/>   
    9.     </mx:column   
    10.      


       注意:creationComplete="DataRo.getList()" : getList()对应DataRomate.java类中getList()方法。
    本文转自:http://lincoln-zhou.javaeye.com/blog/373356
  • 相关阅读:
    sqlserver2008 查看数据库自带的索引建议
    DataSnap服务器生成的ID自动更新到客户端
    outlook 插件:导出rss的link地址
    eclipse 升级note
    合并百度影音的离线数据 with python 2.2 bdv格式的更新
    windows ubuntu bcdeditor
    合并百度影音的离线数据 with python 2.1 bdv格式的更新
    合并百度影音的离线数据 with python 第二版 基于yield
    php密码加密(密码散列)
    PHP (超文本预处理器)
  • 原文地址:https://www.cnblogs.com/daichangya/p/12960206.html
Copyright © 2011-2022 走看看