Hello Shedohan,
Thank you for the answer.
But i don't think that this is what i'm looking for.
My php file (this is not working....documentation siad that it should
work)
HTML Code:
<script type="text/javascript" language="javascript" src="phptester/
phptester.nocache.js"></script>
<script type="text/javascript">
var test = @com.fnk.client.PhpTester::test()();
</script>
Java code:
public class PhpTester implements EntryPoint {
private static final int STATUS_CODE_OK = 200;
/**
* This is the entry point method.
*/
public void onModuleLoad() {
}
public void test(){
DialogBox d = new DialogBox();
d.setText("LOOOOOOOOOOOOOOOOOOO");
d.setHTML("assdafasdfasdfasdf<br/>
asdasdasdaassdafasdfasdfasdf<br/>
asdasdasdaassdafasdfasdfasdf<br/> asdasdasda");
// d.setSize("300px", "200px");
d.show();
}
}
I just want to call the test method from javaScript. Any idea?
On 21 jun, 16:57, Shedokan <[email protected]> wrote:
> I was just yesterday going after the same thing, untill I did some
> testing and found that you can use JSNI to set objects on the window
> without having to worry about their name:
>
> package com.testproject.client;
>
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.core.client.GWT;
>
> public class Test implements EntryPoint {
>
> /**
> * This is the entry point method. Initialize you GWT module here.
> */
> public void onModuleLoad() {
> // Creates an object on the window called "objectName" and
> with a
> value of "objectValue"
> // Equal to window.objectName = "objectValue";
> setWindowObject("objectName", "objectValue");
>
> // Creates a function on the window object with the name of
> "functionName"
> // Equal to window.functionName = function(){
> // window.alert("Function called");
> // };
> setWindowFunction("functionName");
> }
>
> public static native String setWindowObject(String objName, Object
> objValue) /*-{
> $wnd[objName] = objValue;
> }-*/;
>
> public static native String setWindowFunction(String funcName) /*-{
> $wnd[funcName] = function(){
> $wnd.alert("Function called");
> };
> }-*/;
>
> }
>
> This is fairly easy and from the functions you set you can call java
> functions and classes, look in JSNI to find more about this.
> but I wasn't able to overcome setting objects maybe with a little more
> looking and knowing more java would help to find a solution, something
> like a Vector or an array.
>
> Hope this helped.
>
> On 20 יוני, 18:22, cabo087 <[email protected]> wrote:
>
> > Hello all,
>
> > I use javascript and PHP to build my websites.
> > In some PHP pages i call some javascript methods and it works.
>
> > Now i want to use GWT and PHP to develop my websites.
> > How can i call GWT methods from a php file? (like calling javascript)
> > Do i need to make native methods that can be called in php code?
>
> > Please help me out.
>
> > thank you
>
> > Elvin
--
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.