Re: Tapestry 5 Mixins Remoting JSON

2007-05-08 Thread bjornharvold
WORKS GREAT! :-D -- View this message in context: http://www.nabble.com/Tapestry-5-Mixins-Remoting-JSON-tf3676880.html#a10384351 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EM

Re: Tapestry 5 Mixins Remoting JSON

2007-05-08 Thread Andreas Andreou
Better have getUrlFromClass generate a url for a {0} parameter (insted of jsmith) then (at runtime) have javascript that replaces {0} with whatever value you want. On 5/8/07, bjornharvold <[EMAIL PROTECTED]> wrote: Thank you for the lightning response! the parameter "jsmith" is of course the

Re: Tapestry 5 Mixins Remoting JSON

2007-05-08 Thread Andreas Andreou
Just a small comment on this and a quick way to make it more elegant - make it generate href="yourlink/parameter1/parameter2" onclick="rpcFunction(this.href);retrurn false" On 5/8/07, Alexandru Dragomir <[EMAIL PROTECTED]> wrote: The parameters should be in the "urlFromClass" above. So you c

Re: Tapestry 5 Mixins Remoting JSON

2007-05-08 Thread bjornharvold
Thank you for the lightning response! the parameter "jsmith" is of course the runtime text the user enters as his username so there is no way for me to hard code that into the getUrlFromClass method. Javascript is the only thing that knows what the username is at the time of checking. Can I use t

Re: Tapestry 5 Mixins Remoting JSON

2007-05-08 Thread Alexandru Dragomir
The parameters should be in the "urlFromClass" above. So you could have it like this : public String getUrlFromClass() { return resources.createActionLink("rpcTrigger",false,"jsmith").toString(); } In my workspace i made a dirty ajax version of actionLink which generates as href attribute

Re: Tapestry 5 Mixins Remoting JSON

2007-05-08 Thread bjornharvold
Alexandru, How could you add runtime parameters to this Ajax call? e.g. you want to call isUsernameAvailable with parameter "jsmith"? Thanks bjorn -- View this message in context: http://www.nabble.com/Tapestry-5-Mixins-Remoting-JSON-tf3676880.html#a10378474 Sent from the Tapestry - User maili

Re: Tapestry 5 Mixins Remoting JSON

2007-05-02 Thread Alexandru Dragomir
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

Re: Tapestry 5 Mixins Remoting JSON

2007-05-02 Thread Bill Holloway
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 , y

Re: Tapestry 5 Mixins Remoting JSON

2007-05-02 Thread bjornharvold
That's great but is this asynchronous? Alexandru Dragomir wrote: > > Yes , you could do like this : > > template: > > > > > >rpcFunction() { > var yourUrl=${urlFromClass} >. >} > > > > component class : > > @Inject > private ComponentResources resources; > > p

Re: Tapestry 5 Mixins Remoting JSON

2007-05-02 Thread Alexandru Dragomir
Yes , you could do like this : template: rpcFunction() { var yourUrl=${urlFromClass} . } component class : @Inject private ComponentResources resources; public String getUrlFromClass() { return resources.createActionLInk("rpcTrigger",false).toString(); } StreamResponse

Re: Tapestry 5 Mixins Remoting JSON

2007-05-02 Thread bjornharvold
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. Th

Re: Tapestry 5 Mixins Remoting JSON

2007-05-02 Thread Alexandru Dragomir
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