Tuesday, July 18, 2017

Re: Access GWT labels outside ui.client package


 Is there a way to access this label or send messages to this label?

GWT code compiles to JavaScript and runs in the browser (your user interface). Your server code is Java and runs on Tomcat. So you need to communicate between the browser and your server through internet. To do so you normally send a request from the browser to the server, asking the server to return the new data for your label so you can update it in your UI. You can also choose a server push solution if your app needs it, or a combination of both.

To let the browser communicate with the server, GWT itself provides several solutions:
- GWT-RPC: Allows you to call methods on the server
- RequestFactory: Best suited for CRUD / data centric applications
- RequestBuilder: Allows you to make HTTP requests without any additional magic.
- XMLHttpRequest: The three above all use XMLHttpRequest as it is the browser API to make server requests. It is pretty low level so you usually don't use it directly. However you can it you want/need to.

There are other 3rd party libraries that can help you make server requests. For example quite some people use:
- RestyGwt or its successor "autorest": Allows you to make REST style requests.


Hope that helps.

-- J.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment