Heh, those were exactly the pieces I was looking at.

The problem I saw with IJSONRender is that you couldn't have your page
implement renderComponent(IJSONWriter writer,..); it has to be some new
component that declared it. Then you'd attach a listener to this new
component (IDirect?), build a URL with DirectService, and bind() from the
client side to have the json method called. That's a lot of work (compared
to other things in Tapestry :) ) just to have control over contents of your
Ajax response. But then I'm just being lazy :)

Do you think something like this could work?
 - extra param on @EventListener, say, callback(), which takes the name of a
function on the client to call with the built object (a la Yahoo Json web
services). Or if it's not @EventListener that we're using, just pass it as
another parameter on your DirectLink.
 - have IJSONWriter (or the dojo xml writer) accessible by navigating
IRequestCycle

E.g.:

@EventListener(elements = "myFavoriteDiv", events = "onmouseover", callback
= "myObj.handleJson")
public void watchText(IRequestCycle cycle)
{
 // get json writer, something like:
 // IJSONWriter writer =
(IJSONWriter)cycle.getResponseBuilder().getWriter();
 // etc...
}

Or instead of @EventListener, in your template:
<a jwcid="@DirectLink" listener="listener:watchText" json="ognl:true"
callback="myObj.handleJson">...

When response is done, it looks something like:
myObj.handleJson({"message": "Built on server", "time": "lunch time"});

On the client:

var myObj = {
        handleJson: function (jsonResponse) {
                //this is called automatically as soon as response is
eval()'ed
                alert(jsonResponse.message);
        }
}


                
_______________________________________________________ 
Yahoo! Mail - Sempre a melhor opção para você! 
Experimente já e veja as novidades. 
http://br.yahoo.com/mailbeta/tudonovo/
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to