• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

Inject javascript in the UiBinder file

Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to include a java script in my UiBinder composite view.I am preety new to GWT world. So following is what I have done so far to achieve this:-

1) Have put up an entry in my gwt module xml file

2) Following is my Composite Code

3) Following code is there in my UiBinder corresponding java file

4) And finally code in my javascript file

My Problem is still I ma getting the following error while running my GWT app. Please help to solve the issue
Caused by: com.google.gwt.core.client.JavaScriptException: (ReferenceError): '$' is undefined
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
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.praclabs.client.view.HomeView.bind(HomeView.java)
at com.praclabs.client.view.HomeView.onAttach(HomeView.java:16)
at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:470)
at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:127)
at com.google.gwt.user.client.ui.LayoutPanel.insert(LayoutPanel.java:195)
at com.google.gwt.user.client.ui.LayoutPanel.add(LayoutPanel.java:134)
at com.praclabs.client.AppController.onValueChange(AppCon

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the jquery object ($) is bound to the window object.

within JSNI methods, you access the window object via $wnd.

therefore to access the jquery object within a JSNI method you need to do:


or for clarity, access the jquery object by its long name:
Posts: 11445
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch Benjamin!
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!