Duplicating html elements with gwt elements on page load instead of replacing them
mdhirsch30345 Aug 29, 2012 1:23 PMI have a simple html file with two text boxes and a button. I inject those three fields into my java class and add a clickHandler onto the button. That's all it does at the moment. In particular, it doesn't use the ErraiBus at all, and no RPC or other JSON communication is happening.
When the app runs, I can see that the PostConstruct is called, and RootPanel.get().add(this); is executed. After that, I get an error message that there is trouble with parsing some JSON. When I clear the error, I can see 4 text boxes and two buttons--every element is duplicated instead of being replaced.
I've attached my html, java and gwt.xml filed, and here are the logs I see:
Compositing @Replace [data-field=login] element [<button data-field="login" class="btn">Login</button>] with Component com.google.gwt.user.client.ui.Button [<button type="button" class="gwt-Button"></button>]
Compositing @Replace [data-field=userName] element [<input data-field="userName" type="text" placeholder="User name">] with Component com.google.gwt.user.client.ui.TextBox [<input type="text" class="gwt-TextBox">]
Compositing @Replace [data-field=password] element [<input data-field="password" type="password" placeholder="password">] with Component com.google.gwt.user.client.ui.TextBox [<input type="text" class="gwt-TextBox">]
com.google.gwt.json.client.JSONException: Error parsing JSON: SyntaxError: Unexpected token <
at com.google.gwt.json.client.JSONParser.throwJSONException(JSONParser.java:91)
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:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.json.client.JSONParser.evaluate(JSONParser.java)
at com.google.gwt.json.client.JSONParser.parse(JSONParser.java:213)
at com.google.gwt.json.client.JSONParser.parseStrict(JSONParser.java:87)
at org.jboss.errai.bus.client.json.JSONUtilCli.decodePayload(JSONUtilCli.java:59)
at org.jboss.errai.bus.client.framework.ClientMessageBusImpl.procPayload(ClientMessageBusImpl.java:1581)
at org.jboss.errai.bus.client.framework.ClientMessageBusImpl.procIncomingPayload(ClientMessageBusImpl.java:1575)
at org.jboss.errai.bus.client.framework.ClientMessageBusImpl.access$8(ClientMessageBusImpl.java:1574)
at org.jboss.errai.bus.client.framework.ClientMessageBusImpl$11.onResponseReceived(ClientMessageBusImpl.java:1265)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
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:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
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:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:662)
I'm using errai 2.1 and gwt 2.4.0.
Clearly I'm missing something, but I can't figure out what it is.
Thanks,
Michael
-
AnalyticsConsole.java.zip 641 bytes
-
AnalyticsConsole.html.zip 726 bytes
-
AnalyticsConsole.gwt.xml 558 bytes