I have a Google Web Toolkit (GWT) application and when I link to it, I want to pass some arguments/parameters that it can use to dynamically retrieve data. E.g. if it were a stock chart application, I would want my link to contain the symbol and then have the GWT app read that and make a request to some stock service. E.g. http://myapp/gwt/StockChart?symbol=GOOG would be the link to my StockChart GWT app and it would make a request to my stock info web service for the GOOG stock.
So far, I've been using the server-side code to add Javascript variables to the page and then I've read those variables using JSNI (JavaScript Native Interface).
For example:
In the host HTML:
<script type="text/javascript">
var stockSymbol = '<%= request.getParameter("symbol") %>';
</script>
In the GWT code:
public static native String getSymbol() /*-{
return $wnd.stockSymbol;
}-*/;
(Although this code is based on real code that works, I've modified it for this question so I might have goofed somewhere)
However, this doesn't always work well in hosted mode (especially with arrays) and since JSNI wasn't around in version 1.4 and previous, I'm guessing there's another/better way.