You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by roubaozi <la...@gmail.com> on 2009/04/17 23:15:28 UTC

An ajax question (sending ajax request without binded to a component)

Hi,

I am trying to use Tapestry 5.0.18 to finish a small project I am working
on, and I am stuck.

I am trying to accomplish an ajax call from the client side using prototype
Ajax.Request(), and on the server side I am trying to update a
persist(session) property in the page class when the ajax request gets to
the server side. I know all Tapestry ajax approaches are like a mixin or
event binded to a component, and use an event handler method on the server
side to process the request. But my situation is, there is no component I
can bind to, I am triggering the ajax request with some events like
window.onload() or ontimeout() which don't have a Tapestry component I can
bind to.

So how do I send an ajax request from client to a method on the server side?
how do I create the url which the ajax.request is sending to?

Thanks in advance.
-- 
View this message in context: http://www.nabble.com/An-ajax-question-%28sending-ajax-request-without-binded-to-a-component%29-tp23105754p23105754.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: An ajax question (sending ajax request without binded to a component)

Posted by roubaozi <la...@gmail.com>.
Thanks for the reply, I should have thought about that.


HugoPalma wrote:
> 
> Create a method in the class of the page or component from where you're
> making the call like this:
> 
> public String getMyEventUrl(){
>   return componentResources.createEventLink("myEvent").toURI();
> }
> 
> Then on the template your javascript can be something like:
> 
> Ajax.Request('${myEventUrl}')
> 
> On Fri, Apr 17, 2009 at 10:15 PM, roubaozi <la...@gmail.com> wrote:
> 
>>
>> Hi,
>>
>> I am trying to use Tapestry 5.0.18 to finish a small project I am working
>> on, and I am stuck.
>>
>> I am trying to accomplish an ajax call from the client side using
>> prototype
>> Ajax.Request(), and on the server side I am trying to update a
>> persist(session) property in the page class when the ajax request gets to
>> the server side. I know all Tapestry ajax approaches are like a mixin or
>> event binded to a component, and use an event handler method on the
>> server
>> side to process the request. But my situation is, there is no component I
>> can bind to, I am triggering the ajax request with some events like
>> window.onload() or ontimeout() which don't have a Tapestry component I
>> can
>> bind to.
>>
>> So how do I send an ajax request from client to a method on the server
>> side?
>> how do I create the url which the ajax.request is sending to?
>>
>> Thanks in advance.
>> --
>> View this message in context:
>> http://www.nabble.com/An-ajax-question-%28sending-ajax-request-without-binded-to-a-component%29-tp23105754p23105754.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/An-ajax-question-%28sending-ajax-request-without-binded-to-a-component%29-tp23105754p23141922.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: An ajax question (sending ajax request without binded to a component)

Posted by Hugo Palma <hu...@gmail.com>.
Create a method in the class of the page or component from where you're
making the call like this:

public String getMyEventUrl(){
  return componentResources.createEventLink("myEvent").toURI();
}

Then on the template your javascript can be something like:

Ajax.Request('${myEventUrl}')

On Fri, Apr 17, 2009 at 10:15 PM, roubaozi <la...@gmail.com> wrote:

>
> Hi,
>
> I am trying to use Tapestry 5.0.18 to finish a small project I am working
> on, and I am stuck.
>
> I am trying to accomplish an ajax call from the client side using prototype
> Ajax.Request(), and on the server side I am trying to update a
> persist(session) property in the page class when the ajax request gets to
> the server side. I know all Tapestry ajax approaches are like a mixin or
> event binded to a component, and use an event handler method on the server
> side to process the request. But my situation is, there is no component I
> can bind to, I am triggering the ajax request with some events like
> window.onload() or ontimeout() which don't have a Tapestry component I can
> bind to.
>
> So how do I send an ajax request from client to a method on the server
> side?
> how do I create the url which the ajax.request is sending to?
>
> Thanks in advance.
> --
> View this message in context:
> http://www.nabble.com/An-ajax-question-%28sending-ajax-request-without-binded-to-a-component%29-tp23105754p23105754.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>