Wednesday, February 10, 2021

Re: How do we make GWT accept dynamic domain name?

You can try to create a hidden element on the HTML file with the server name. Example:

<input type="hidden" name="server-name" id="server-name" value="SERVER NAME HERE">

And you can get the value in GWT with:
InputElement input = (InputElement) Document.get().getElementById("server-name");
String serverName = input.getValue();

Another way is creating in the HTML file, a Javascript global variable via script tag or script file and load this via GWT using JSNI or JSInterop (the example is with JSNI):

public class ServerNameUtil {
public static native String getServerName() /*-{
   return $wnd.SERVER_NAME;

You can improve these ideas for your solution. IT is some ideas to help you to think of the best solution for your scenario. :)

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
To view this discussion on the web visit

No comments:

Post a Comment