4 Replies Latest reply on Apr 2, 2010 1:35 AM by marasma1@libero.it

    Problem with Datagrid and java remote object


      Hi ! I'm italian boys, excuse me for my bad english.

      I have a java remote object, a service that return a list this is the interface:





      import java.rmi.Remote;
      import java.rmi.RemoteException;
      import java.util.List;

      import interfaces.utente.facade.dto.UtenteDTO;


      public interface UtenteServiceFacade extends Remote {

      List<UtenteDTO> cercaTuttiGliUtenti() throws RemoteException;


      This service is esposed by blazeds remote-service.

      For visualizing data i have wrote the following client :




      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

           <s:RemoteObject id="utenteService" destination="utenteServiceFacade"/>
          <mx:DataGrid id="utentiDTODg"
                  dataProvider="{utenteService.cercaTuttiGliUtenti.lastResult}" width="100%" />
          <mx:Button label="Get Data" click="utenteService.cercaTuttiGliUtenti()"/>

      when i click button, the data from the service is returned, but the datagrid remain empty...why????

      thanks for the response.....

        • 2. Re: Problem with Datagrid and java remote object
          marasma1@libero.it Level 1

          I have modified my client code has follow:


          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*">

                      import mx.controls.Alert;
                      import mx.collections.ArrayCollection;
                      import mx.rpc.events.ResultEvent;
                      import mx.rpc.events.FaultEvent;
                      import mx.utils.ArrayUtil;
                      import valueobjects.UtenteDTO;
                      private var contacts:ArrayCollection;

                      private function resultHandler(event:ResultEvent):void
                      contacts =  event.result as ArrayCollection;
                      var utentedto:UtenteDTO = contacts[0] as UtenteDTO;
                      Alert.show("contacts = " + contacts);

                      Alert.show("utentedto: " + utentedto.nome);


                      private function faultHandler(event:FaultEvent):void
              <mx:RemoteObject id="utenteService" destination="utenteServiceFacade" fault="faultHandler(event)">
                  <mx:method name="cercaTuttiGliUtenti" result="resultHandler(event)"/>

              <mx:ApplicationControlBar width="100%">
                  <mx:TextInput id="searchStr"/>
                  <mx:Button label="Search" click="utenteService.cercaTuttiGliUtenti()"/>

              <mx:HDividedBox width="100%" height="100%">
                  <mx:DataGrid id="dg" dataProvider="{contacts}" width="30%" height="100%">
                          <mx:DataGridColumn dataField="nome" headerText="First Name"/>
                          <mx:DataGridColumn dataField="cognome" headerText="Last Name"/>

          And the output Alert is :


          utentedto: null

          contacts: [object UtenteDTO],[object UtenteDTO]




          while UtenteDTO is:

          package valueobjects
              import mx.collections.ArrayCollection;
              public class UtenteDTO
                  public var cognome:String;
                  public var nome:String;
                  public var telefono:String;
                  public var indirizzoEmail:String;
                  public var note:String;
                  public var polo:String;
                  public var statoCensimento:String;
                  public var nomeSocieta:String;
                  public var nomeDirezione:String;
                  public var livelloOperativo:String;
                  public var ambito:String;
                  public var figuraProfessionale:String;
                  public var tipoContratto:String;
                  public var dataInizioContratto:Date;
                  public var dataModificaContratto:Date;
                  public var dataFineContratto:Date;
                  public var nomeLoginRemedy:String;
                  public var nomeLoginZproject:String;
                  public function UtenteDTO()

          Help me please!!!!

          • 3. Re: Problem with Datagrid and java remote object
            marasma1@libero.it Level 1

            I had modified the UtenteDTO with

            Externalizable interface,but now recive the following error:

            was expecting mx.messaging.messages.AcknowledgeMessage but received null