3 Replies Latest reply on Jul 1, 2008 11:11 AM by Joey-ATL

    How do I get the returned text from a Servlet

    Joey-ATL
      I made a File Upload on a Flex3 app which sends the uploaded file to a Java Servlet (using Apache FileUpload library). I am uploading a .CSV file that is parsed by Java and the servlet returns the contents in XML which works fine when I use JSP to upload to the Servlet but how to I get the returned text from the Servlet using the Flex app?

      I am using this approach for the file upload in Flex:
      quote:


      fileReference = FileReference(fileList[0]);
      fileReference.addEventListener(Event.COMPLETE, uploadCompleteHandler);
      fileReference.upload(urlRequest);



      and the handler function looks like this:

      quote:


      private function uploadCompleteHandler(event:Event):void{
      statusText.text = "File " + event.target.name + " uploaded successfully.";
      }



      I'd like to get the text that is returned back from the servlet so I can use it in the Flex app. Is there another approach that I should use for file upload? Is there a better way to do a File Upload when you want to receive text back?

      Thanks in advance!