0

私はArrayListどこにShortcutVirtualSystemEntryありますか:

public class ShortcutVirtualSystemEntry extends VirtualSystemEntry implements IsSerializable {

  public ShortcutVirtualSystemEntry(String id, String label, String image,
      String tooltip, String parent, int x, int y, int tray, Command action) {
    super(id, label, image, tooltip, parent, x, y, tray, action);
  }

public ShortcutVirtualSystemEntry() {

}

}

ArrayList呼び出しを介してクライアントからサーバーに渡そうとするRPCと、リストのすべてのオブジェクトがインスタンス化されますが、RPC にはデータがありません:

docService.saveDocument2(shortcuts,
                new AsyncCallback<Void>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        Window.alert("Faliled");
                        caught.printStackTrace();
                    }

                    @Override
                    public void onSuccess(Void result) {
                        Window.alert("Success");

                    }
                });

サーバ側:

@Override
public void saveDocument2(
        List<ShortcutVirtualSystemEntry> shortcuts) {
    for(ShortcutVirtualSystemEntry v: shortcuts)
    {
        System.out.println("Image "+v.getImage());// Prints : Image null...
    }


}

では、なぜリスト データを失わなければならないのでしょうか。私が間違っていること

事前にどうもありがとう:)

4

2 に答える 2

0

私が言える限り、あなたのコードは機能するはずです。おそらく、問題は別の場所にあります。つまり、コンストラクターで Image を設定するのを忘れたか、Image を設定していないだけです。

GWT で重要なことは、RPC を介して送信するオブジェクトがシリアル化可能であり、多くの場合、これらのオブジェクトに対して空のコンストラクターを作成するのにも役立ちます。

サラジョグ

于 2013-06-12T07:35:38.100 に答える