The function rpcFunction() is the async part. I'm using dojo , so the function looks like :
function rpcFunction() { var kw = { url: "${urlFromClass}", load: function(type, data, evt) { // do what you want with "data" retrieved from server side }, method: "GET", mimetype:"text/json" }; dojo.io.bind(kw); } Alex On 5/2/07, Bill Holloway <[EMAIL PROTECTED]> wrote:
Also, what do you do with yourUrl once you have it? In addition, the JSONRpcClient constructor expects to be talking to a servlet. T5 is a ServletFilter. Bill On 5/2/07, bjornharvold <[EMAIL PROTECTED]> wrote: > > That's great.... but is this asynchronous? > > > Alexandru Dragomir wrote: > > > > Yes , you could do like this : > > > > template: > > > > > > > > <script> > > > > rpcFunction() { > > var yourUrl=${urlFromClass} > > ..... > > } > > </script> > > > > > > component class : > > > > @Inject > > private ComponentResources resources; > > > > public String getUrlFromClass() { > > return resources.createActionLInk("rpcTrigger",false).toString(); > > } > > > > StreamResponse onRpcTrigger() { > > //build your json object and wrapp it in a StreamResponse > > return streamResponse; > > } > > > > hope i haven't forgot anything. > > > > Alex > > > > > > On 5/2/07, bjornharvold <[EMAIL PROTECTED]> wrote: > >> > >> > >> Sounds interesting. I looked at component events. Are you saying that you > >> can > >> invoke a component action based on a javascript event such as > >> "mouseDown"? > >> To me it seems that you can only invoke based on a submit action. I want > >> the > >> UI, through AJAX, to talk to some service and get JSON data back. The URL > >> to > >> the json data could be as simple as a link to a jsp that creates the json > >> data string. > >> > >> When I meant jsonrpc-bridge I meant the specific open source > >> implementation > >> here: http://oss.metaparadigm.com/jsonrpc/index.html > >> > >> > >> Alexandru Dragomir wrote: > >> > > >> > I didn't get what you meant by jsonrpc bridge. > >> > The way i do it and it works fine is implementing an "onAction" method > >> > that > >> > returns StreamResponse : > >> > > >> > StreamResponse onActionFromYourComp() {....} > >> > > >> > The method returns a json object wrapped by the StreamResponse. > >> > Mixins are useful when you want to add new ajax behavior to already > >> > existent > >> > "non ajax" aware components(if i'm not wrong.. ). > >> > > >> > hope it helps, > >> > Alex > >> > > >> > > >> > On 5/1/07, bjornharvold <[EMAIL PROTECTED]> wrote: > >> >> > >> >> > >> >> I have a front-end that wants JSON data from the back-end. Using a > >> >> regular > >> >> webapp I would integrate JSON-RPC. I started out doing this with my t5 > >> >> app > >> >> and quickly realized I had to write something to put the jsonrpc > >> bridge > >> >> in > >> >> the session (like a listener) and then some component that would have > >> >> access > >> >> to the session and use the bridge. Then I thought of the mixins, which > >> I > >> >> admittedly don't yet fully understand..... but then again I guess it's > >> >> not > >> >> fully implemented either ;-) > >> >> > >> >> How would something like auto-complete and validation be done with t5 > >> >> using > >> >> mixins.... or is it still better to use jsonrpc as I described above? > >> I > >> >> am > >> >> looking at the mixin page and don't really find anything useful there. > >> >> > >> >> thx > >> >> bjorn > >> >> -- > >> >> View this message in context: > >> >> > >> http://www.nabble.com/Tapestry-5-Mixins-Remoting-JSON-tf3676880.html#a10274739 > >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. > >> >> > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >> For additional commands, e-mail: [EMAIL PROTECTED] > >> >> > >> >> > >> > > >> > > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/Tapestry-5-Mixins-Remoting-JSON-tf3676880.html#a10291531 > >> Sent from the Tapestry - User mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > -- > View this message in context: http://www.nabble.com/Tapestry-5-Mixins-Remoting-JSON-tf3676880.html#a10293059 > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "The future is here. It's just not evenly distributed yet." -- Traditional --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]