SmartGWT module parameters

Is there any way to specify external parameters (in html or javascript), which would be accessible from the main EntryPoint class ? How one would access such parameters from the java code in the EntryPoint module ?

For example, we have a separate login.jsp page which upon successful login redirects to the project.html file, responsible for rendering the rest of the application.

The issue is, we also need to implement a language switch on the same login page, and somehow pass the locale token to the code in the EntryPoint class, since we need to know the locale before rendering the main screen.

Is that possible ? Did anyone implement the i18n in this way ?

Thank you,

– mitek

Are you aware that passing the request parameter “locale” automatically kicks in the GWT i18n mechanism? For example “?locale=fr_FR”

If you want to read parameters in your module entry point, pass them as request parameters to the URL and use Window.Location.getParameter to retrieve them.

Thank you, that was exactly what I was looking for. And it works, I can pass a parameter to EntryPoint class via the standard index.html?param=value mechanism. Great.

> Are you aware that passing the request parameter “locale” automatically kicks in the GWT i18n mechanism?

no, not really. Is there some sort of document that would describe that mechanism ?

– mitek

It’s in the GWT docs.

Thank you. This doc section looks extremely helpful.

Your original question is more a GWT question than a SmartGwt question, and I think you would have found the answer by searching or asking the GWT group.

(But asking this question on the SmartGwt forum allowed you to get information about i18n, so you win)

Anyway, in case you want to access init parameters from your GWT code, you should use the Dictionary class.

Here is a blog post talking about it (make sure to go to the pages the post links to, too).

But keep in mind, as mentioned by others, that there are far better ways to internationalize your app. I simply mention the Dictionary class in case you want to initialize other kind of parameters.