I have a Google Web Toolkit (GWT) application, and when I refer to it, I want to pass some arguments / parameters that it can use to dynamically retrieve data. For example. if it was a stock chart application, I would like my link to contain a symbol, and then the GWT application read it and made a request to some stock service. For example. http: // myapp / gwt / StockChart? symbol = GOOG will be a link to my StockChart GWT application and it will access my web service on the GOOG stock exchange.
So far I have used server-side code to add Javascript variables to the page, and then I read these variables using JSNI (native JavaScript interface).
For example:
In the HTML host:
<script type="text/javascript"> var stockSymbol = '<%= request.getParameter("symbol") %>'; </script>
In the GWT code:
public static native String getSymbol() ;
(Despite the fact that this code is based on real code that works, I modified it for this question so that I can stub somewhere)
However, this does not always work well in host mode (especially with arrays), and since JSNI was not in version 1.4 and the previous one, I assume there is a different / better way.
gwt
KC Baltz
source share