Hi,

There is a bit change in approach. Somehow i am now able to connect to GWT 
from my external HTML/website.
The way I have done is on click of a button in my html , I open a new window 
which loads the GWT Host HTML which in turns calls a JSNI method.
The problem is now to pass some parameter from my website/HTML to GWT native 
method.

Please help me out to get some way.

Thanking you for much needed help & co-operation.

Regards
Manish

----- Original Message ----- 
From: "Manuel" <[EMAIL PROTECTED]>
To: <[email protected]>; <[EMAIL PROTECTED]>
Sent: Thursday, November 27, 2008 1:26 AM
Subject: Re: How to do cross site implementation in GWT


>
> One thing I just noticed in your code is that you are  exporting java
> methods to javascript. When I tryied that a few weeks ago I could not
> figure out how the instance expression part worked, so I only have
> tried this with static methods
> e.g.
>
> public static int displayDialog(String companyId, String companyName) {
> ResponseDialog.getInstance().doSplash(companyId, companyName);
> return 0;
> }
> public static native void exportJavaMethod() /*-{
> $wnd.sendEmail =
> @com.fbg.client.Emailer::displayDialog(Ljava/lang/String;Ljava/lang/String;);
> }-*/;
> and then calling the function from any javascript code in the host as
> sendEmail(id, name)
>
> Perhaps you can try changing PMGWTHtmlUtils::invokeGWT to be a static 
> function
>
>
> On Wed, Nov 26, 2008 at 11:32 AM, Manuel <[EMAIL PROTECTED]> wrote:
>> I pretty much followed the steps detailed in
>>
>> http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=FAQ_JSONFeedsFromOtherDomain
>>
>> Plus I am passing parameters via javascript variables in the host
>> page. The code in the host page looks like:
>>
>> <script type="text/javascript">
>>        var fbg_customerId = '2222238976';
>>        var fbg_type = 'vertical';
>> </script>
>> <script type="text/javascript" language="javascript"
>> src="http://www.gov-world.com/gwt/com.fbg.headlinesreader.HeadlinesReader.nocache.js";></script>
>> <div id="fbgPressReleases">
>> </div>
>>
>> in the onModuleLoad() function I call the following native function to
>> read the javascript variables
>>
>>        public native void getParameters() /*-{
>> 
>> [EMAIL PROTECTED]::parameter_id =
>> $wnd.fbg_customerId;
>> 
>> [EMAIL PROTECTED]::parameter_format
>> = $wnd.fbg_type;
>>         }-*/;
>>
>> and after that I call the makeJSONRequest() function which is declared
>> as follows:
>>
>>
>>        public static native void makeJSONRequest(String url, JSONHandler 
>> handler) /*-{
>>                $wnd.jsonCallback = function(jsonObj) {
>> 
>> @com.fbg.headlinesreader.client.HeadlinesReader::dispatchJSON(Lcom/google/gwt/core/client/JavaScriptObject;Lcom/fbg/headlinesreader/client/JSONHandler;)(jsonObj,
>> handler);
>>                }
>>
>>                // create SCRIPT tag, and set SRC attribute equal to JSON 
>> feed URL +
>> callback function name
>>                var script = $wnd.document.createElement("script");
>>                script.setAttribute("src", url+"jsonCallback");
>>                script.setAttribute("type", "text/javascript");
>> 
>> $wnd.document.getElementsByTagName("head")[0].appendChild(script);
>>
>>        }-*/;
>>
>>        public static void dispatchJSON(JavaScriptObject jsonObj, 
>> JSONHandler
>> handler) {
>>                handler.handleJSON(jsonObj);
>>        }
>>
>>        public void handleJSON(JavaScriptObject obj)  {
>>                // String s;
>>                if (obj == null) {
>>                        // grr
>>                        return;
>>                }
>>
>>                JSONArray myarr;
>>                JSONObject myObj;
>>                myarr = new JSONArray(obj);
>>                for (int i=0; i<myarr.size();i++) {
>>                        myObj = myarr.get(i).isObject();
>>                        headlines.add(  new Headline(
>> 
>> myObj.get("title").isString().stringValue().trim(),
>> 
>> myObj.get("link").isString().stringValue().trim(),
>> 
>> myObj.get("create_date").isString().stringValue().trim()
>>                        ) );
>>                }
>>                showNews();  //and this finally adds widgets to the 
>> element
>> fbgPressReleases in the host page
>>        }
>>
>>
>>
>> I read that there was an inssue with firefox 3 and IE7 that made
>> difficult to access the window object of a webpage from a script
>> loaded from a different domain, so my Assumption is that the
>> <add-linker name="xs" /> in the configuration signals GWT to work
>> around this issue
>>
>>
>>
>>
>> On Tue, Nov 25, 2008 at 8:36 PM, Manish Kumar <[EMAIL PROTECTED]> 
>> wrote:
>>>
>>> Hi Manuel,
>>>
>>> Thanx for response.But I wanna know how do you passing the parameter 
>>> from
>>> our website/HTML to gwt component.
>>> is this by using JSNI.if yes , how do attached your compiled gwt app 
>>> source
>>> to your website/html.This point is crucial for me
>>> since i am not able to connect to gwt from our html in deployment 
>>> mode( not
>>> hosted mode ).
>>>
>>> please provide the detail about your approach.
>>>
>>> Regards
>>> Manish
>>>
>>> ----- Original Message -----
>>> From: "Manuel Aguilera" <[EMAIL PROTECTED]>
>>> To: "Google Web Toolkit" <[email protected]>
>>> Sent: Wednesday, November 26, 2008 1:13 AM
>>> Subject: Re: How to do cross site implementation in GWT
>>>
>>>
>>>
>>> I was having a similar Issue. I am working on an application that will
>>> load a short list of headlines from our website via cross-site
>>> json.The gwt files,  the json feed and the host HTML page reside on
>>> different domains. On the Module XML format page in the developer
>>> guide (http://code.google.com/docreader/#p=google-web-toolkit-
>>> doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideModuleXml) the method
>>> suggested was including something similar to:
>>>
>>> <module>
>>>  <inherits name="com.google.gwt.core.Core" />
>>>  <add-linker name="xs" />
>>> </module>
>>>
>>> however after uploading the output files I got a couple of permission
>>> errors on Firefox, namely:
>>>
>>> Permission denied to get property Window.document
>>> http://192.168.1.145/com.fbg.headlinesreader.HeadlinesReader/6F72E8AB842459823620F4AC11938839.cache.html
>>> Line 1
>>>
>>> What I did was to remove the <inherits
>>> name="com.google.gwt.core.Core" /> element from the module xml file.
>>> Mine looks as follows:
>>> <module>
>>> <inherits name='com.google.gwt.user.User'/>
>>> <inherits name='com.google.gwt.user.theme.standard.Standard'/>
>>>
>>> <inherits name="com.google.gwt.json.JSON" />
>>> <inherits name="com.google.gwt.http.HTTP" />
>>>
>>> <entry-point class='com.fbg.headlinesreader.client.HeadlinesReader'/
>>>>
>>> <stylesheet src='HeadlinesReader.css' />
>>>
>>> <add-linker name="xs" />
>>>
>>> </module>
>>>
>>> I am not sure why but it seems to be working ok now. I Hope this helps
>>>
>>> Regards,
>>> Manuel Aguilera
>>>
>>>
>>>
>>> On Nov 25, 1:25 am, "Manish Kumar" <[EMAIL PROTECTED]> wrote:
>>>> Hi everybody,
>>>>
>>>> can anybody plz help me out to get the right path for cross site
>>>> implementation.
>>>>
>>>> please go through the mail below and make me aware about my approach.
>>>>
>>>> Thanx & Regards
>>>> Manish
>>>>
>>>> ----- Original Message -----
>>>> From: "Manish Kumar" <[EMAIL PROTECTED]>
>>>> To: <[email protected]>
>>>> Sent: Monday, November 24, 2008 11:12 AM
>>>> Subject: How to do cross site implementation in GWT
>>>>
>>>> > Hi everybody,
>>>>
>>>> > I has working for 2 months on GWT( 1.5.3 ). I have been successful in
>>>> > implementing various feature in GWT. Finally I am stuck at end for
>>>> > almost
>>>> > 20
>>>> > days in including my GWT project to a set of HTML files with passing 
>>>> > a
>>>> > set
>>>> > of values to GWT from HTML.
>>>> > Previously also I put this issue in this forum as i was trying with 
>>>> > JSNI
>>>> > and
>>>> > xs linker.Now i am running out of time. Time has come for
>>>> > decision.Thanks
>>>> > for constant help and co-operation.
>>>>
>>>> > Now can anybody please confirm my approach? Since still I suspect my
>>>> > approach.
>>>>
>>>> > I have a set of HTML files. I have made and GWT project including 
>>>> > some
>>>> > widgets , rpc and a external server( calling using request builder ). 
>>>> > I
>>>> > have
>>>> > wriiten a JSNI method in GWT component which is called by a GWT 
>>>> > method
>>>> > called inside onModuleLoad.
>>>> > I have wriiten a js method( on HTML side) which calls JSNI method.
>>>>
>>>> > I compiled the GWT component using xs linker and added nocache.js in 
>>>> > my
>>>> > HTML(in HEAD part). I am expecting that this will invoke GWT 
>>>> > component
>>>> > as
>>>> > js
>>>> > method ( html side ) is called on click of a button displayed in 
>>>> > HTML.
>>>>
>>>> > A couple of months back I had got this but I don't understand why 
>>>> > this
>>>> > is
>>>> > not working this time.There is a remarkable observation is that
>>>> > previously
>>>> > I
>>>> > had got xs-nocache.js and my JSNI method inside that.This I am not
>>>> > getting
>>>> > now.
>>>>
>>>> > One more thing I would like to know that what is the role of 
>>>> > cache.js?
>>>>
>>>> > Can anybody provide me what is mistake/is this workable or not.
>>>>
>>>> > Regards
>>>> > Manish
>>>
>>>
>>>
>>> >>
>>>
>>
>>
>>
>> --
>> ++>+++++++++++[<+++++++>-]<.>++++[<--->-]<.>++++[<+++>-]<+.+++++++.>++++[<---->-]<.+++++++.
>>
>
>
>
> -- 
> ++>+++++++++++[<+++++++>-]<.>++++[<--->-]<.>++++[<+++>-]<+.+++++++.>++++[<---->-]<.+++++++.
>
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to