- You can put a <script> tag directly in the GWT manifest file to include the external JavaScript you need (you can also include css using <style> tag).
<module> <inherits name='com.google.gwt.user.User'/> ... <script src="http://maps.google.com/maps/api/js?sensor=true"> </script> </module> Document source:http://blog.vzv.ca/2011/04/integrating-javascript-libraries-in-gwt.html 2010. szeptember 22., szerda 9:39:22 UTC+2 időpontban vkrejcirik a következőt írta: > > I try to use javascript library Canviz for rendering dot file to image > on client side in my GWT application. I did these steps: > > 1) Insert <script> elements into my html main page. > > <script type="text/javascript" src="js/prototype.js"></script> > <script type="text/javascript" src="js/path.js"></script> > <script type="text/javascript" src="js/canviz.js"></script> > <script type="text/javascript" src="js/x11colors.js"></script> > > 2) In java class, I create HTML object and set: > > image1.setHTML("<div id=\"image_2\"></div>"); > > 3) Then I create native method: > > public static native void getImage2(String dot) /*-{ > > var canviz; > > canviz = new $wnd.Canviz("image_2"); > canviz.load(dot); > > }-*/; > > > When I push the button and call method getImage2, then I get this > error: > > > com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot > set property 'innerHTML' of null > stack: TypeError: Cannot set property 'innerHTML' of null > at klass.load (http://127.0.0.1:8889/js/canviz.js:464:31) > at unknown source > at __gwt_jsInvoke (http://127.0.0.1:8889/clan/hosted.html?clan: > 70:35) > at eval at <anonymous> (http://127.0.0.1:8889/clan/hosted.html? > clan:54:12 <http://127.0.0.1:8889/clan/hosted.html?clan:54:12>) > at XMLHttpRequest.<anonymous> (unknown source) > at unknown source > at __gwt_jsInvoke (http://127.0.0.1:8889/clan/hosted.html?clan: > 70:35) > at eval at <anonymous> (http://127.0.0.1:8889/clan/hosted.html? > clan:54:12 <http://127.0.0.1:8889/clan/hosted.html?clan:54:12>) > at XMLHttpRequest.onreadystatechange (unknown source) > type: non_object_property_store > arguments: innerHTML, > __gwt_ObjectId: 3497 > at > com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java: > > > 195) > 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.invokeNativeObject(ModuleSpace.java: > 264) > 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:188) > at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > 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.reactToMessages(BrowserChannel.java: > > 1669) > at > com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java: > > > 401) > at > com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java: > > 222) > at java.lang.Thread.run(Unknown Source) > > > Could you help me please? Thanks. > > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/6SWnji7vltAJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
