Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8159841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:03:34+00:00 2026-06-06T18:03:34+00:00

I am using GWT to write a simple app. Ive divided the view into

  • 0

I am using GWT to write a simple app. Ive divided the view into various sections using the dockPanel.
I need to invoke a script that invokes facebook functionality within a certain panel of the dockPanel. Here is the code in Java

public class XXXX implements EntryPoint 
{
private DockLayoutPanel dock = new DockLayoutPanel(Unit.PX); 
private HorizontalPanel navPanel = new HorizontalPanel();
private VerticalPanel fbPanel = new VerticalPanel();
private HorizontalPanel ratingsPanel = new HorizontalPanel();
private Marker m = null;
private InfoWindow iw = null;
MapWidget map= null;

public void onModuleLoad() 
{
    implementDockPanelLayout();
    implementMapView();

        // Add the facebook Javascript script to the fbPanel of the dock
    injectFBInitCode();
    RootLayoutPanel.get().add(dock);
}


private void implementDockLayoutSetup() 
{
        navPanel.add(new HTML("<h3>Navigation Panel</h3>"));
    fbPanel.add(new HTML("<div id = \"fb-root\"><h3>FB Comments should go here </h3></div>"));
    ratingsPanel.add(new HTML("<h3>Ratings Here</h3>"));
    dock.addNorth(navPanel, 50);
    dock.addEast(fbPanel, 300);
    dock.addSouth(ratingsPanel, 50);
}


private native void injectFBInitCode() /*-{
//??How to associate this script with the fbPanel which contains 
    the div with id= fb-root
function(d, s, id) 
{
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=XXXXXX";
    fjs.parentNode.insertBefore(js, fjs);
}
(document, 'script', 'facebook-jssdk');
}-*/;

private void implementMapView() 
     {
      ...}

When I run the above code, I get an exception in my browser:

  08:29:05.514 [ERROR] [SomeProj] Unable to load module entry point class  XXX.client.SomeProj (see associated exception for details)
 com.google.gwt.core.client.JavaScriptException: (null): null
 at   com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
 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.invokeNativeVoid(ModuleSpace.java:289)
 at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
 at cs310.client.someProj.injectFBInitCode(someProj.java)
 at cs310.client.someProj.onModuleLoad(someProj.java:53)
 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.ModuleSpace.onLoad(ModuleSpace.java:396)
 at  com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
 at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
 at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
 at java.lang.Thread.run(Thread.java:680)

Iam not that familiar with how to call Javascript functions from within my GWT code. I looked at the tutorials and some samples and came up with this code. But Im stuck,

Can someone give me a hand with this.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:03:35+00:00Added an answer on June 6, 2026 at 6:03 pm

    when in JSNI you need to use the variable ‘$wnd’ to access the actual window.. so you should call ‘$wnd.document’

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing a web app, which uses sessions. I'm using GWT and app engine
I'm using Eclipse Indigo on win XP and trying to write a GWT test
I am trying to write a phonegap app with GWT for windows phone 7.
I'm using GWT-log in order to write log messages. for now, I can see
I am working on different technologies and frameworks. I write: web applications using GWT,
I am using GWT 2.2 with RequestFactory. The app has an existing service layer
I have a GWT application for which I'm trying to write some tests using
I'm using GWT 2.4. I'm trying to write a test case where I make
We decided to write client side application using Ext GWT it is good and
I'm using GWT to create a simply app that allows teachers to create easily

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.