I'm currently trying to implement a simple servlet that will dynamically create the host html page to be able to support dynamic internationalization of the application similar to the suggested approach from this thread[1].
The code I have is the following: import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class I18nServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); out.println("<!DOCTYPE html><html><head><link type=\"text/css \" rel=\"stylesheet\" href=\"LeonidsExplorer.css\">"+ "<title>PreferencesExplorer</title>"+ "<script type=\"text/javascript\" language=\"javascript\" src=\"LeonidsExplorer.nocache.js\"/></head>"+ "<body><script type=\"text/javascript\" language= \"javascript\">"+ "var ResourceMessages = {"+ "\"login.dialog.username.label\": \"Username\","+ "\"login.dialog.password.label\": \"Password\","+ "\"login.dialog.title\": \"Login\","+ "\"login.dialog.username.example\": \"usern...@authority \","+ "\"login.dialog.button\": \"Login\","+ "\"preferences.header.view.preferences.button\": \"Preferences\","+ "\"preferences.header.view.admins.button\": \"Administrators\","+ "\"preferences.header.view.logout.button\": \"Logout\","+ "\"preferences.header.view.help.link\": \"Help\","+ "\"preferences.header.view.welcome\": \"Welcome\""+ "\"admins.panel.view.big.label\": \"Authorities\","+ "\"authority.select.view.root.admins.text\": \"Root Administrators\"};"+ "</script></body></html>" ); } } I have the web.xml file configured so this servlet will get called when the host html file is accessed. When running in hosted mode, the page doesn't load because of the following exception: java.util.MissingResourceException: 'ResourceMessages' is not a JavaScript object and cannot be used as a Dictionary at com.google.gwt.i18n.client.Dictionary.resourceErrorBadType(Dictionary.java: 100) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java: 71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java: 157) at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java: 1713) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java: 165) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java: 120) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java: 507) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java: 284) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java: 107) at com.google.gwt.i18n.client.Dictionary.attach(Dictionary.java) at com.google.gwt.i18n.client.Dictionary.<init>(Dictionary.java:121) at com.google.gwt.i18n.client.Dictionary.getDictionary(Dictionary.java: 93) The code in the onModuleLoad() method is simply doing: Dictionary.getDictionary("ResourceMessages"); Viewing the source of the page I see the page generated by the servlet. The title of the page loads so the servlet is being called. Does anyone have any suggestions on what's preventing it from locating the dictionary? Is it a race/timing issue because the page hasn't loaded yet by the time the GWT code starts executing? Thanks for your help, Micah [1] -http://groups.google.com/group/google-web-toolkit/browse_thread/ thread/53c36ddcf511d36/7076c34b8e090d67?lnk=gst&q=Proper+way+to +dynamically+internationalize+an+already+compiled+application+Options +#7076c34b8e090d67 -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.