0 Replies Latest reply on Aug 22, 2006 6:41 AM by JSSanders

    Retrieving XML from Java Component

      Does anyone have a walkthrough or anything that kinda shows this process? I know I am doing something wrong, but I am not sure what. I think its just a syntax error like I am doing things in the wrong order or missing some step.

      Here is my java code: (I know tomcat is connecting to it, and I know flex is also because the logger shows me the return information)

      package javaSamples;

      // Simple class to pass an xml message
      public class DataGrid
      public String getDataGrid()
      String xml = "";
      xml +="<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
      "<grid>" +
      "<items>" +
      "<item><name=\"Book\"><price=\"10.99\"></item>" +
      "<item><name=\"Lamp\"><price=\"49.00\"></item>" +
      "<item><name=\"Chair\"><price=\"99.99\"></item>" +
      "</items>" +

      return xml;

      Here is my MXL file.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="{dataGridObject.getDataGrid()}">
      <mx:RemoteObject id="dataGridObject" destination="dataGrid">
      <mx:method name="getDataGrid" concurrency="last" result="setDataGrid(event.result as XML)"/>

      import mx.rpc.events.ResultEvent

      private function setDataGrid(a:XML):void{

      var newXML:XML = a;
      [Bindable] var myDP:XML = newXML;

      <mx:Panel x="10" y="232" width="250" height="200" layout="absolute" title="Simple Data Grid">
      <mx:DataGrid x="0" y="10" width="230" dataProvider="{dataGridObject.getDataGrid}">
      <mx:DataGridColumn headerText="Name" dataField="name"/>
      <mx:DataGridColumn headerText="Price" dataField="price"/>
      <mx:DataGridColumn headerText="Column 3" dataField="col3"/>


      If anyone has an example of this I would really appreciate any help.