tags:

views:

33

answers:

1

I asked this at the GWT forum but I'm impatient for the answer and I seem to get rather good responses here.

A html or jsp file is used to launch the xxx.nocache.js, which then decides which browser "permutation" to use.

<head>
 <meta http-equiv="content-type" content="text/html;charset=UTF-8">
 <title>xxx</title>
 <script type="text/javascript" language="javascript" src="xxx.nocache.js"></script>
</head>

In my case, I am using a jsp. When the JSP is executed, it discovers some conditions. I wish to pass these conditions as values to the GWT module being launched. The "elegant" GWT way to pass these values would be to persist them as request/memcache attributes and then have the GWT module perform RPC to retrieve those values.

For example, the JSP discovers that the current user is Whoopy. Shouldn't I simply have the JSP generate javascript to store

user = "Whoopy"

as a top or namedframe level javascript variable and use JSNI within the module to retrieve the value for user?

I have not tried it yet, but I would like to know how anyone might have done it without having to use RPC.

+2  A: 

Shouldn't I simply have the JSP generate javascript to store user = "Whoopy"

YES, you should. Its always best to reduce RPC calls for performance reasons.

Take a look at the Dictionary class. It allows you to read JSON strings stored in the HTML without resorting to JSNI methods. Its meant for just this purpose

sri