2010-12-13 35 views
7

J'ai donc lu la documentation sur l'inclusion d'un fichier Javascript externe directement dans le module manifeste yourApplication.gwt.xml (http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects .html)GWT incluant le fichier javascript externe du manifeste du module

J'ai ce fichier javascript appelé iscroll.js et stocké dans le dossier war/du projet GWT.

j'ai ajouté la ligne le manifeste du module de ma demande GWT:

<script src="iscroll.js"/> 

Puis, à partir de la méthode onModuleLoad() j'appelle cette méthode de JSNI native:

private native void initJavascript() /*-{ 
    $wnd.myScroll = new iScroll('jokeWrapperLabel'); 
}-*/; 

Puis, quand je lance le code le navigateur que je reçois toujours "iScroll est indéfini".

Une idée de ce que je fais mal?

C'est la sortie du « iScroll est une erreur non définie »

18:32:41.780 [ERROR] [jollyjokesprogwt] Unable to load module entry point class com.wanderlust.jollyjokespro.gwt.client.JollyJokesProGWT (see associated exception for details) 
com.google.gwt.core.client.JavaScriptException: (ReferenceError): iScroll is not defined 
stack: ReferenceError: iScroll is not defined 
    at [object Object].<anonymous> (unknown source) 
    at __gwt_jsInvoke (http://127.0.0.1:8888/jollyjokesprogwt/hosted.html?jollyjokesprogwt:76:35) 
    at http://127.0.0.1:8888/jollyjokesprogwt/hosted.html?jollyjokesprogwt:280:16 
    at C (http://127.0.0.1:8888/jollyjokesprogwt/jollyjokesprogwt.nocache.js:2:148) 
    at http://127.0.0.1:8888/jollyjokesprogwt/jollyjokesprogwt.nocache.js:8:593 
type: not_defined 
arguments: iScroll 
__gwt_ObjectId: 91 
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237) 
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126) 
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) 
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289) 
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) 
    at com.wanderlust.jollyjokespro.gwt.client.JollyJokesProGWT.initJavascript(JollyJokesProGWT.java) 
    at com.wanderlust.jollyjokespro.gwt.client.JollyJokesProGWT.onModuleLoad(JollyJokesProGWT.java:228) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) 
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183) 
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510) 
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) 
    at java.lang.Thread.run(Unknown Source) 
+0

Si vous inspectez la page après le chargement de votre module (à l'aide des outils de développement Firebug ou Chrome), voyez-vous une balise '