• 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
  • 相关阅读:
    Hibernate+mysql 中文问题解决方案.
    FpSpread表格控件,FpSpread事件介绍(一)
    如何实现打开有宏的EXCEL时不提示
    使用VB.Net写一个简单的数据访问层(不能称ORM):CRUD操作
    Asp.NET 时间Since转换
    64位操作系统上。NET操作MSMQ的问题
    IIS7配置管理Windows2008 64位系统IIS7的问题
    数据库开发批量附加数据库
    IIS7中对静态文件的处理
    techsailor三步曲
  • 原文地址:https://www.cnblogs.com/daichangya/p/12960206.html
Copyright © 2020-2023  润新知