It explains how to code for Server side mashups so that you can
perform cross site JSONP calls.
In the article he uses the handle method (Shown below) to handle the
return from the server side:
public void handle(JavaScriptObject jso) {
JSONObject json = new JSONObject(jso);
JSONArray ary =
json.get("feed").isObject().get("entry").isArray();
for (int i = 0; i < ary.size(); ++i) {
RootPanel.get().add(new
Label(ary.get(i).isObject().get("title").isObject().get("$t").toString()));
}
}
I have tried writing my own basic Java Servlet GET/POST we all know
the score and I can successfully call into my servlet but I never get
back to my client side, in this case after the servlet has done its
stuff, I never go back to the handle method to perform some whizz bang
GWT stuff - is there something specific you are required to do on the
server side? Such as extends RemoteServiceServlet as you would do in a
normal GWT AsyncCallback call? Anyone got any ideas?
To get it to work you need to get the plumbing right, and it's not
quite the same way as calling from code - btw, the example on that
page is aimed at client side not server side. The server is any
language you want as long as it returns a well-formed JavaScript
segment of the form:
mycallback({....some json content....})
So your servlet would work as long as it returns something like the
above.
In this approach you don't call the servlet in the normal way from the
program code, rather it gets called as a consequence of adding a
<script> tag to the DOM - this is what the addScript() method in the
example code does. Once the script is added to the DOM the browser
accesses the defined url of your service and expects a response. As
the response is a JavaScript function, it will get evaluated in the
browser.
If you also define a function in the DOM with the same name you expect
back in the server response, e.g. mycallback, and that function calls
the GWT handle() function then the loop is closed. The example code
adds such a function using the setUp() method.
The example code reserves a new function name for each "call" made to
the server, adds that new function to the DOM and then the <script>
tag.
Where things usually go wrong are if the server returns a function
name not set up, or the response is not a valid javascript expression.
Hope that helps in some small way!
//Adam
this then gets evaluated in the browser
On 6 Okt, 17:02, eggsy84 <jimbob...@hotmail.com> wrote:
> It explains how to code for Server side mashups so that you can
> perform cross site JSONP calls.
> In the article he uses the handle method (Shown below) to handle the
> return from the server side:
> public void handle(JavaScriptObject jso) {
> JSONObject json = new JSONObject(jso);
> JSONArray ary =
> json.get("feed").isObject().get("entry").isArray();
> for (int i = 0; i < ary.size(); ++i) {
> RootPanel.get().add(new
> Label(ary.get(i).isObject().get("title").isObject().get("$t").toString()));
> }
> }
> I have tried writing my own basic Java Servlet GET/POST we all know
> the score and I can successfully call into my servlet but I never get
> back to my client side, in this case after the servlet has done its
> stuff, I never go back to the handle method to perform some whizz bang
> GWT stuff - is there something specific you are required to do on the
> server side? Such as extends RemoteServiceServlet as you would do in a
> normal GWT AsyncCallback call? Anyone got any ideas?
Thank you for the reply it definately helps! when you say it needs to
be well-formed javascript I have implemented a method that performs
the following:
Would that be sufficient? Well I ask the question but I assume not as
with my implementation I successfully go back to my client handle
method now but the JavascriptObject passed in is always null.
My client side handle method is very basic as a test (shown below) and
I can confirm that when the claa is complete is definately hits this
method so the glue between is wrong somehow?
public void handleJsonResponse(JavaScriptObject jso)
{
if (jso == null)
{
Window.alert("Unable to parse JSON");
return;
}
else
{
Window.alert("Well done Woohoo!!");
}
}
eggsy
On Oct 6, 9:28 pm, Adam T <adam.t...@gmail.com> wrote:
> To get it to work you need to get the plumbing right, and it's not
> quite the same way as calling from code - btw, the example on that
> page is aimed at client side not server side. The server is any
> language you want as long as it returns a well-formed JavaScript
> segment of the form:
> mycallback({....some json content....})
> So your servlet would work as long as it returns something like the
> above.
> In this approach you don't call the servlet in the normal way from the
> program code, rather it gets called as a consequence of adding a
> <script> tag to the DOM - this is what the addScript() method in the
> example code does. Once the script is added to the DOM the browser
> accesses the defined url of your service and expects a response. As
> the response is a JavaScript function, it will get evaluated in the
> browser.
> If you also define a function in the DOM with the same name you expect
> back in the server response, e.g. mycallback, and that function calls
> the GWT handle() function then the loop is closed. The example code
> adds such a function using the setUp() method.
> The example code reserves a new function name for each "call" made to
> the server, adds that new function to the DOM and then the <script>
> tag.
> Where things usually go wrong are if the server returns a function
> name not set up, or the response is not a valid javascript expression.
> Hope that helps in some small way!
> //Adam
> this then gets evaluated in the browser
> On 6 Okt, 17:02, eggsy84 <jimbob...@hotmail.com> wrote:
> > Hi all,
> > Taking the informative article by Dan Morrill at GWT
> > It explains how to code for Server side mashups so that you can
> > perform cross site JSONP calls.
> > In the article he uses the handle method (Shown below) to handle the
> > return from the server side:
> > public void handle(JavaScriptObject jso) {
> > JSONObject json = new JSONObject(jso);
> > JSONArray ary =
> > json.get("feed").isObject().get("entry").isArray();
> > for (int i = 0; i < ary.size(); ++i) {
> > RootPanel.get().add(new
> > Label(ary.get(i).isObject().get("title").isObject().get("$t").toString()));
> > }
> > }
> > I have tried writing my own basic Java Servlet GET/POST we all know
> > the score and I can successfully call into my servlet but I never get
> > back to my client side, in this case after the servlet has done its
> > stuff, I never go back to the handle method to perform some whizz bang
> > GWT stuff - is there something specific you are required to do on the
> > server side? Such as extends RemoteServiceServlet as you would do in a
> > normal GWT AsyncCallback call? Anyone got any ideas?
I think what you are missing is the function name in your output from
the servlet. From what I see, you just return:
[{color: \"red\",value: \"#f00\"}]
when I would expect a response something like:
mycallback([{color: \"red\",value: \"#f00\"}])
where the "mycallback" is the name of the function you add to the DOM
which calls your handleJSONResponse method - without returning a
function from your servlet, I'm not sure how your handle method is
being called.
Also, are you defining your callback code to pick up the parameter,
e.g.
> Thank you for the reply it definately helps! when you say it needs to
> be well-formed javascript I have implemented a method that performs
> the following:
> Would that be sufficient? Well I ask the question but I assume not as
> with my implementation I successfully go back to my client handle
> method now but the JavascriptObject passed in is always null.
> My client side handle method is very basic as a test (shown below) and
> I can confirm that when the claa is complete is definately hits this
> method so the glue between is wrong somehow?
> On Oct 6, 9:28 pm, Adam T <adam.t...@gmail.com> wrote:
> > Eggsy,
> > To get it to work you need to get the plumbing right, and it's not
> > quite the same way as calling from code - btw, the example on that
> > page is aimed at client side not server side. The server is any
> > language you want as long as it returns a well-formed JavaScript
> > segment of the form:
> > mycallback({....some json content....})
> > So your servlet would work as long as it returns something like the
> > above.
> > In this approach you don't call the servlet in the normal way from the
> > program code, rather it gets called as a consequence of adding a
> > <script> tag to the DOM - this is what the addScript() method in the
> > example code does. Once the script is added to the DOM the browser
> > accesses the defined url of your service and expects a response. As
> > the response is a JavaScript function, it will get evaluated in the
> > browser.
> > If you also define a function in the DOM with the same name you expect
> > back in the server response, e.g. mycallback, and that function calls
> > the GWT handle() function then the loop is closed. The example code
> > adds such a function using the setUp() method.
> > The example code reserves a new function name for each "call" made to
> > the server, adds that new function to the DOM and then the <script>
> > tag.
> > Where things usually go wrong are if the server returns a function
> > name not set up, or the response is not a valid javascript expression.
> > Hope that helps in some small way!
> > //Adam
> > this then gets evaluated in the browser
> > On 6 Okt, 17:02, eggsy84 <jimbob...@hotmail.com> wrote:
> > > Hi all,
> > > Taking the informative article by Dan Morrill at GWT
> > > I have tried writing my own basic Java Servlet GET/POST we all know
> > > the score and I can successfully call into my servlet but I never get
> > > back to my client side, in this case after the servlet has done its
> > > stuff, I never go back to the handle method to perform some whizz bang
> > > GWT stuff - is there something specific you are required to do on the
> > > server side? Such as extends RemoteServiceServlet as you would do in a
> > > normal GWT AsyncCallback call? Anyone got any ideas?
> I think what you are missing is the function name in your output from
> the servlet. From what I see, you just return:
> [{color: \"red\",value: \"#f00\"}]
> when I would expect a response something like:
> mycallback([{color: \"red\",value: \"#f00\"}])
> where the "mycallback" is the name of the function you add to the DOM
> which calls your handleJSONResponse method - without returning a
> function from your servlet, I'm not sure how your handle method is
> being called.
> Also, are you defining your callback code to pick up the parameter,
> e.g.
> without the (Lcom/google/gwt/core/client/JavaScriptObject;)(someData)
> part it won't pick up the returned data
> //Adam
> On 7 Okt, 10:14, eggsy84 <jimbob...@hotmail.com> wrote:
> > Hi Adam,
> > Thank you for the reply it definately helps! when you say it needs to
> > be well-formed javascript I have implemented a method that performs
> > the following:
> > Would that be sufficient? Well I ask the question but I assume not as
> > with my implementation I successfully go back to my client handle
> > method now but the JavascriptObject passed in is always null.
> > My client side handle method is very basic as a test (shown below) and
> > I can confirm that when the claa is complete is definately hits this
> > method so the glue between is wrong somehow?
> > On Oct 6, 9:28 pm, Adam T <adam.t...@gmail.com> wrote:
> > > Eggsy,
> > > To get it to work you need to get the plumbing right, and it's not
> > > quite the same way as calling from code - btw, the example on that
> > > page is aimed at client side not server side. The server is any
> > > language you want as long as it returns a well-formed JavaScript
> > > segment of the form:
> > > mycallback({....some json content....})
> > > So your servlet would work as long as it returns something like the
> > > above.
> > > In this approach you don't call the servlet in the normal way from the
> > > program code, rather it gets called as a consequence of adding a
> > > <script> tag to the DOM - this is what the addScript() method in the
> > > example code does. Once the script is added to the DOM the browser
> > > accesses the defined url of your service and expects a response. As
> > > the response is a JavaScript function, it will get evaluated in the
> > > browser.
> > > If you also define a function in the DOM with the same name you expect
> > > back in the server response, e.g. mycallback, and that function calls
> > > the GWT handle() function then the loop is closed. The example code
> > > adds such a function using the setUp() method.
> > > The example code reserves a new function name for each "call" made to
> > > the server, adds that new function to the DOM and then the <script>
> > > tag.
> > > Where things usually go wrong are if the server returns a function
> > > name not set up, or the response is not a valid javascript expression.
> > > Hope that helps in some small way!
> > > //Adam
> > > this then gets evaluated in the browser
> > > On 6 Okt, 17:02, eggsy84 <jimbob...@hotmail.com> wrote:
> > > > Hi all,
> > > > Taking the informative article by Dan Morrill at GWT
> > > > I have tried writing my own basic Java Servlet GET/POST we all know
> > > > the score and I can successfully call into my servlet but I never get
> > > > back to my client side, in this case after the servlet has done its
> > > > stuff, I never go back to the handle method to perform some whizz bang
> > > > GWT stuff - is there something specific you are required to do on the
> > > > server side? Such as extends RemoteServiceServlet as you would do in a
> > > > normal GWT AsyncCallback call? Anyone got any ideas?
mmm, your code below doesn't really follow the pattern in the link of
your first post - however, I think I know why your handle method is
calling. The code below seems to use a timer to loop around checking
if something has been returned, if not it fires your handler with null
- which explains why you handler is called and you only see null. I
assume that if you add the method name to your response you would
eventually get your handler called with a value.
I might misunderstand the code on the web site you link to, but I
personally would recommend using the code shown in Dan's article
(http://code.google.com/support/bin/answer.py? answer=65632&topic=11368 ) for the client side. It works fine,
removes the need for a timer (which is going to take resource in your
application) and truly handles the asynchronous nature of the web.
//Adam
On 7 Okt, 13:46, eggsy84 <jimbob...@hotmail.com> wrote:
> > where the "mycallback" is the name of the function you add to the DOM
> > which calls your handleJSONResponse method - without returning a
> > function from your servlet, I'm not sure how your handle method is
> > being called.
> > Also, are you defining your callback code to pick up the parameter,
> > e.g.
> > without the (Lcom/google/gwt/core/client/JavaScriptObject;)(someData)
> > part it won't pick up the returned data
> > //Adam
> > On 7 Okt, 10:14, eggsy84 <jimbob...@hotmail.com> wrote:
> > > Hi Adam,
> > > Thank you for the reply it definately helps! when you say it needs to
> > > be well-formed javascript I have implemented a method that performs
> > > the following:
> > > Would that be sufficient? Well I ask the question but I assume not as
> > > with my implementation I successfully go back to my client handle
> > > method now but the JavascriptObject passed in is always null.
> > > My client side handle method is very basic as a test (shown below) and
> > > I can confirm that when the claa is complete is definately hits this
> > > method so the glue between is wrong somehow?
> > > On Oct 6, 9:28 pm, Adam T <adam.t...@gmail.com> wrote:
> > > > Eggsy,
> > > > To get it to work you need to get the plumbing right, and it's not
> > > > quite the same way as calling from code - btw, the example on that
> > > > page is aimed at client side not server side. The server is any
> > > > language you want as long as it returns a well-formed JavaScript
> > > > segment of the form:
> > > > mycallback({....some json content....})
> > > > So your servlet would work as long as it returns something like the
> > > > above.
> > > > In this approach you don't call the servlet in the normal way from the
> > > > program code, rather it gets called as a consequence of adding a
> > > > <script> tag to the DOM - this is what the addScript() method in the
> > > > example code does. Once the script is added to the DOM the browser
> > > > accesses the defined url of your service and expects a response. As
> > > > the response is a JavaScript function, it will get evaluated in the
> > > > browser.
> > > > If you also define a function in the DOM with the same name you expect
> > > > back in the server response, e.g. mycallback, and that function calls
> > > > the GWT handle() function then the loop is closed. The example code
> > > > adds such a function using the setUp() method.
> > > > The example code reserves a new function name for each "call" made to
> > > > the server, adds that new function to the DOM and then the <script>
> > > > tag.
> > > > Where things usually go wrong are if the server returns a function
> > > > name not set up, or the response is not a valid javascript expression.
> > > > > I have tried writing my own basic Java Servlet GET/POST we all know
> > > > > the score and I can successfully call into my servlet but I never get
> > > > > back to my client side, in this case after the servlet has done its
> > > > > stuff, I never go back to the handle method to perform some whizz bang
> > > > > GWT stuff - is there something specific you are required to do on the
> > > > > server side? Such as extends RemoteServiceServlet as you would do in a
> > > > > normal GWT AsyncCallback call? Anyone got any ideas?
> mmm, your code below doesn't really follow the pattern in the link of
> your first post - however, I think I know why your handle method is
> calling. The code below seems to use a timer to loop around checking
> if something has been returned, if not it fires your handler with null
> - which explains why you handler is called and you only see null. I
> assume that if you add the method name to your response you would
> eventually get your handler called with a value.
> I might misunderstand the code on the web site you link to, but I
> personally would recommend using the code shown in Dan's article
> (http://code.google.com/support/bin/answer.py? > answer=65632&topic=11368 ) for the client side. It works fine,
> removes the need for a timer (which is going to take resource in your
> application) and truly handles the asynchronous nature of the web.
> //Adam
> On 7 Okt, 13:46, eggsy84 <jimbob...@hotmail.com> wrote:
> > > where the "mycallback" is the name of the function you add to the DOM
> > > which calls your handleJSONResponse method - without returning a
> > > function from your servlet, I'm not sure how your handle method is
> > > being called.
> > > Also, are you defining your callback code to pick up the parameter,
> > > e.g.
> > > without the (Lcom/google/gwt/core/client/JavaScriptObject;)(someData)
> > > part it won't pick up the returned data
> > > //Adam
> > > On 7 Okt, 10:14, eggsy84 <jimbob...@hotmail.com> wrote:
> > > > Hi Adam,
> > > > Thank you for the reply it definately helps! when you say it needs to
> > > > be well-formed javascript I have implemented a method that performs
> > > > the following:
> > > > Would that be sufficient? Well I ask the question but I assume not as
> > > > with my implementation I successfully go back to my client handle
> > > > method now but the JavascriptObject passed in is always null.
> > > > My client side handle method is very basic as a test (shown below) and
> > > > I can confirm that when the claa is complete is definately hits this
> > > > method so the glue between is wrong somehow?
> > > > On Oct 6, 9:28 pm, Adam T <adam.t...@gmail.com> wrote:
> > > > > Eggsy,
> > > > > To get it to work you need to get the plumbing right, and it's not
> > > > > quite the same way as calling from code - btw, the example on that
> > > > > page is aimed at client side not server side. The server is any
> > > > > language you want as long as it returns a well-formed JavaScript
> > > > > segment of the form:
> > > > > mycallback({....some json content....})
> > > > > So your servlet would work as long as it returns something like the
> > > > > above.
> > > > > In this approach you don't call the servlet in the normal way from the
> > > > > program code, rather it gets called as a consequence of adding a
> > > > > <script> tag to the DOM - this is what the addScript() method in the
> > > > > example code does. Once the script is added to the DOM the browser
> > > > > accesses the defined url of your service and expects a response. As
> > > > > the response is a JavaScript function, it will get evaluated in the
> > > > > browser.
> > > > > If you also define a function in the DOM with the same name you expect
> > > > > back in the server response, e.g. mycallback, and that function calls
> > > > > the GWT handle() function then the loop is closed. The example code
> > > > > adds such a function using the setUp() method.
> > > > > The example code reserves a new function name for each "call" made to
> > > > > the server, adds that new function to the DOM and then the <script>
> > > > > tag.
> > > > > Where things usually go wrong are if the server returns a function
> > > > > name not set up, or the response is not a valid javascript expression.
> > > > > > I have tried writing my own basic Java Servlet GET/POST we all know
> > > > > > the score and I can successfully call into my servlet but I never get
> > > > > > back to my client side, in this case after the servlet has done its
> > > > > > stuff, I never go back to the handle method to perform some whizz bang
> > > > > > GWT stuff - is there something specific you are required to do on the
> > > > > > server side? Such as extends RemoteServiceServlet as you would do in a
> > > > > > normal GWT AsyncCallback call? Anyone got any ideas?
public String reserveCallback()
{
while (true)
{
if (!callbacks.containsKey(new Integer(curIndex)))
{
callbacks.put(new Integer(curIndex), null);
return "__gwt_callback" + curIndex++;
}
}
}
/**
* <p>Adds the JSONP script to our widget so we can make XSS requests
baby</p>
*
* @param uniqueId The unique id of the call
* @param url The URL of our Request
*/
public void addScript(String uniqueId, String url)
{
Element e = DOM.createElement("script");
DOM.setElementAttribute(e, "language", "JavaScript");
DOM.setElementAttribute(e, "src", url);
scriptTags.put(uniqueId, e);
DOM.appendChild(RootPanel.get().getElement(), e);
}
public void handle(JavaScriptObject jso)
{
if( jso != null )
{
Window.alert("Woohoo JSO is not null it bloody worked");
}
}
/**
*
* <p>Sets up our Javascript cross site JSON call</p>
*
* @param model Handles our Cross Site JSON call
* @param callback
*/
public native static void setup(CallModel model, String callback)
/*-{
$wnd[callback] = function(someData)
{
mod...@com.myPackage.MyCall::handle(Lcom/google/gwt/core/client/
JavaScriptObject;)(someData);
}
}-*/;
============
Then importantly in my server side I have used the callback name in my
JSON output as you quite rightly mention!! :)
> Thank you for this insight - I'll use Dans code for my client side to
> fix this and add the callback as a parameter!
> Thank you for all your help! I'll let you know how I get on
> Regards,
> On Oct 7, 1:03 pm, Adam T <adam.t...@gmail.com> wrote:
> > mmm, your code below doesn't really follow the pattern in the link of
> > your first post - however, I think I know why your handle method is
> > calling. The code below seems to use a timer to loop around checking
> > if something has been returned, if not it fires your handler with null
> > - which explains why you handler is called and you only see null. I
> > assume that if you add the method name to your response you would
> > eventually get your handler called with a value.
> > I might misunderstand the code on the web site you link to, but I
> > personally would recommend using the code shown in Dan's article
> > (http://code.google.com/support/bin/answer.py? > > answer=65632&topic=11368 ) for the client side. It works fine,
> > removes the need for a timer (which is going to take resource in your
> > application) and truly handles the asynchronous nature of the web.
> > //Adam
> > On 7 Okt, 13:46, eggsy84 <jimbob...@hotmail.com> wrote:
> > > > where the "mycallback" is the name of the function you add to the DOM
> > > > which calls your handleJSONResponse method - without returning a
> > > > function from your servlet, I'm not sure how your handle method is
> > > > being called.
> > > > Also, are you defining your callback code to pick up the parameter,
> > > > e.g.
> > > > > Thank you for the reply it definately helps! when you say it needs to
> > > > > be well-formed javascript I have implemented a method that performs
> > > > > the following:
> > > > > Would that be sufficient? Well I ask the question but I assume not as
> > > > > with my implementation I successfully go back to my client handle
> > > > > method now but the JavascriptObject passed in is always null.
> > > > > My client side handle method is very basic as a test (shown below) and
> > > > > I can confirm that when the claa is complete is definately hits this
> > > > > method so the glue between is wrong somehow?
> > > > > On Oct 6, 9:28 pm, Adam T <adam.t...@gmail.com> wrote:
> > > > > > Eggsy,
> > > > > > To get it to work you need to get the plumbing right, and it's not
> > > > > > quite the same way as calling from code - btw, the example on that
> > > > > > page is aimed at client side not server side. The server is any
> > > > > > language you want as long as it returns a well-formed JavaScript
> > > > > > segment of the form:
> > > > > > So your servlet would work as long as it returns something like the
> > > > > > above.
> > > > > > In this approach you don't call the servlet in the normal way from the
> > > > > > program code, rather it gets called as a consequence of adding a
> > > > > > <script> tag to the DOM - this is what the addScript() method in the
> > > > > > example code does. Once the script is added to the DOM the browser
> > > > > > accesses the defined url of your service and expects a response. As
> > > > > > the response is a JavaScript function, it will get evaluated in the
> > > > > > browser.
> > > > > > If you also define a function in the DOM with the same name you expect
> > > > > > back in the server response, e.g. mycallback, and that function calls
> > > > > > the GWT handle() function then the loop is closed. The example
> public String reserveCallback()
> {
> while (true)
> {
> if (!callbacks.containsKey(new Integer(curIndex)))
> {
> callbacks.put(new Integer(curIndex), null);
> return "__gwt_callback" + curIndex++;
> }
> }
> }
> /**
> * <p>Adds the JSONP script to our widget so we can make XSS requests
> baby</p>
> *
> * @param uniqueId The unique id of the call
> * @param url The URL of our Request
> */
> public void addScript(String uniqueId, String url)
> {
> Element e = DOM.createElement("script");
> DOM.setElementAttribute(e, "language", "JavaScript");
> DOM.setElementAttribute(e, "src", url);
> scriptTags.put(uniqueId, e);
> DOM.appendChild(RootPanel.get().getElement(), e);
> }
> public void handle(JavaScriptObject jso)
> {
> if( jso != null )
> {
> Window.alert("Woohoo JSO is not null it bloody worked");
> }
> PrintWriter out = resp.getWriter();
> out.println(output);
> }
> And its not hitting my handler
> Thank you very much for your help. I'm going to post a tutorial on my
> bloghttp://eggsylife.blogspot.comand will credit help toward
> yourself.
> Eggsy
> On Oct 7, 1:10 pm, eggsy84 <jimbob...@hotmail.com> wrote:
> > Hi Adam
> > Thank you for this insight - I'll use Dans code for my client side to
> > fix this and add the callback as a parameter!
> > Thank you for all your help! I'll let you know how I get on
> > Regards,
> > On Oct 7, 1:03 pm, Adam T <adam.t...@gmail.com> wrote:
> > > mmm, your code below doesn't really follow the pattern in the link of
> > > your first post - however, I think I know why your handle method is
> > > calling. The code below seems to use a timer to loop around checking
> > > if something has been returned, if not it fires your handler with null
> > > - which explains why you handler is called and you only see null. I
> > > assume that if you add the method name to your response you would
> > > eventually get your handler called with a value.
> > > I might misunderstand the code on the web site you link to, but I
> > > personally would recommend using the code shown in Dan's article
> > > (http://code.google.com/support/bin/answer.py? > > > answer=65632&topic=11368 ) for the client side. It works fine,
> > > removes the need for a timer (which is going to take resource in your
> > > application) and truly handles the asynchronous nature of the web.
> > > //Adam
> > > On 7 Okt, 13:46, eggsy84 <jimbob...@hotmail.com> wrote:
> > > > > where the "mycallback" is the name of the function you add to the DOM
> > > > > which calls your handleJSONResponse method - without returning a
> > > > > function from your servlet, I'm not sure how your handle method is
> > > > > being called.
> > > > > Also, are you defining your callback code to pick up the parameter,
> > > > > e.g.
> > > > > > Thank you for the reply it definately helps! when you say it needs to
> > > > > > be well-formed javascript I have implemented a method that performs
> > > > > > the following:
> > > > > > Would that be sufficient? Well I ask the question but I assume not as
> > > > > > with my implementation I successfully go back to my client handle
> > > > > > method now but the JavascriptObject passed in is always null.
> > > > > > My client side handle method is very basic as a test (shown below) and
> > > > > > I can confirm that when the claa is complete is definately hits this
> > > > > > method so the glue between is wrong somehow?
> > > > > > On Oct 6, 9:28 pm, Adam T <adam.t...@gmail.com> wrote:
> > > > > > > Eggsy,
> > > > > > > To get it to work you need to get the plumbing right, and it's not
> > > > > > > quite the same way as calling from code - btw, the example on that
> > > > > > > page is aimed at client side not server side. The server is any