3 Replies Latest reply on Jul 21, 2011 1:34 AM by G1Z

    RemoteObject - Java ArrayList to Flex ArrayCollection

    TOMLEE1TOMLEE

      Hi All,

       

      I am getting problem to get the Java ArrayList into Flex ArrayCollection. The result of MainDTO.itemList (which is a ArrayList in java also) always as Null. Here is the sample code:

      JAVA
      ItemDTO.java
      package com.package;
      public class ItemDTO {

          private String itemName;

         // gettets and setters

      }

      MainDTO.java
      package com.package;

      public class MainDTO {

          private String mainName;
          private ArrayList<ItemDTO> itemList;

         // gettets and setters

      }

       

      Flex

      ItemDTO.as
      package {
      [RemoteClass(alias="com.package.ItemDTO")]
      public class ItemDTO {
          public var itemName:String;
      }
      }

       

      MainDTO.as
      package {

      [RemoteClass(alias="com.package.MainDTO")]
      public class MainDTO {
         public var mainName:String;
         public var itemList:ArrayCollection;
      }
      }

       

      A java backend will return the arrayCollection of MainDTO to Flex. In Flex, i can retrieve the list of MainDTO.mainName by looping the result arraycollection.

      The ArrayCollection like this:
      [MainDTO1], [MainDTO2], [MainDTO3], [MainDTO4]................................

       

      However, when flex read the MainDTO.itemList, it always return as null. In java, MainDTO should contains itemList object (which is the ItemDTO object).

       

      Any one can provide solution to me? Many thanks for your help.

       

      Thanks.
      TOMLEE