1 Reply Latest reply on Dec 21, 2010 5:14 AM by saisri2k2

    HttpService : Getting ArrayList to ArrayCollection .

    kiran7881 Level 1

      Hi ,

        In my Servlet , i am getting data into an  ArrayList (Java) .
      I am using
      PrintWriter out = response.getWriter();

      out.println("One");
      out.println("Two");
      out.println("Three");
      out.println("Four");

       


      Now , inside my Flex UI on to the result function call

       

      public var ac:ArrayCollection  = new ArrayCollection();

      public function getData(event:ResultEvent):void
      {

      ac =  event.result as ArryCollection
      }


      Is this Correct ?? Please suggest . Thanks .

        • 1. Re: HttpService : Getting ArrayList to ArrayCollection .
          saisri2k2 Level 4

          Nope... you wil get

           

          one

          two

          three

          four

           

          as the responnse.. becuse they are strings. If you want array list, use blazeds. or

          if you send data like

           

          one,two,three,four

           

          then do (event.result as String).split(',')

           

          will return array. nd you can convert to array collection later. ac = new arrayCollection( (event.result as String).split(','))

           

           

          if none of the above work for you .. use a xml in the response like the following.. and parse it in the UI

           

          printWriter.println("someHugeXmlString");

           

           

          In UI

          (event.result as XML).one

          (event.result as XML).two

          (event.result as XML).three

           

          Message was edited by: saisri2k2