I'm trying to create an example app to demonstrate that GWT can use
existing Javascript functions, but so far I've been unable to get it
to work correctly.  I've named my project JS_Integration_Example and I
created it from the default Web Application Starter Project that is
provided when you create a new GWT project in eclipse.  I'd really
appreciate anyone who could point out what my problem is.  I've done
some Googling on this subject but so far haven't found any specific
examples showing exactly where to put the js file and what to add to
the gwt.xml file.

I've create a file named general.js that contains the following js
function

function helloWorld(){
        return "Hello World";
}


I call the function from JS_Integration_Example.java by using the
following JSNI method

/** Java Script Via JSNI */
public native String helloWorld2()/*-{
        return $wnd.helloWorld();
 }-*/;


I placed general.js in a folder named scripts that is in the src
package and I added the following line to the
JS_Integration_Example.gwt.xml

<module rename-to='js_integration_example'>

  <script src="scripts/general.js"></script>

 ...

When I try to run it I get the following warning & errors :
[WARN] 404 - GET /js_integration_example/scripts/general.js
(127.0.0.1) 1427 bytes
   Request headers
      Accept: */*
      Accept-Language: en-us
      User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR
3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2; MS-RTC LM
8; .NET4.0C; .NET4.0E)
      Accept-Encoding: gzip, deflate
      Host: 127.0.0.1:8888
      Connection: Keep-Alive
      Referer: 
http://127.0.0.1:8888/JS_Integration_Example.html?gwt.codesvr=127.0.0.1:9997
   Response headers
      Content-Type: text/html; charset=iso-8859-1
      Content-Length: 1427

09:45:26.536 [ERROR] [js_integration_example] Uncaught exception
escaped
com.google.gwt.event.shared.UmbrellaException: One or more exceptions
caught, see full set in UmbrellaException#getCauses
    at
com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:
129)
...

-- 
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-toolkit@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.

Reply via email to