Ce contenu n'est pas disponible dans la langue sélectionnée.
25.3. Hooking up a GWT widget to the Seam component
Next, write a method that returns the asynchronous interface to the component. This method can be located inside the widget class, and will be used by the widget to obtain a reference to the asynchronous client stub:
Finally, write the widget code that invokes the method on the client stub. The following example creates a simple user interface with a label, text input, and a button:
When clicked, this button invokes the
askServer()
method, passing the contents of the input text. In this example, it also validates that the input is a valid question. The askServer()
method acquires a reference to the asynchronous client stub (returned by the getService()
method) and invokes the askIt()
method. The result (or error message, if the call fails) is shown in an alert window.
The complete code for this example can be found in the Seam distribution in the
examples/remoting/gwt
directory.