You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Joachim Schrod <js...@acm.org> on 2014/07/11 02:47:18 UTC
Best practice sought: Register client change at server
Hi,
In a Wicket application I have JQuery code that triggers after a
certain time of user inactivity. I need to tell server-side about
that inactivity. No problem, I thought, just issue an AJAX request.
Well, looking around I found several possibilities to do that as a
side effect, but no component at first hand that is made up for
that task. I thought that's strange, it doesn't sound as a remote
demand. So my question is about best practice for this use case.
Namely: I have a change on client-side that I want to communicate
to server-side. No changes in DOM are associated. Just like
triggering an AjaxLink where onClick() does not call any methods on
target. I know about the JavaScript function Wicket.Ajax.ajax() and
its arguments. My problem is choosing the right component server-side.
An AjaxEventBehavior would be the right thing, but I don't have a
component to attach it to. The worst solution would be a hidden
AjaxLink. IMO I simply need to establish a listener URL that
triggers some method, an URL that I can use in a Wicket.Ajax.ajax()
call -- but I don't find the Wicket component that supplies me with
that functionality.
How can I do that?
Or is my focus on the Wicket.Ajax.ajax() JS interface blocking my
view on another solution that's better?
I know my way around Wicket's code and documentation. Thus, a hint
like "start with class XYZ" would be very much appreciated, I don't
need a full solution with code. I'm surely missing something
obvious and would severely appreciate any help or tips.
Cheers,
Joachim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jschrod@acm.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Best practice sought: Register client change at server
Posted by Joachim Schrod <js...@acm.org>.
I didn't know that I can introduce my own event names, I thought I
had to use one of the pre-defined ones.
Thanks for that enlightenment, it works like a charm.
Joachim
On 07/11/14 12:01, Martin Grigorov wrote:
> page.add(new AjaxEventBehavior("my-special-event") {...});
>
> in JS code: jQuery(document).triggerHandler('my-special-event');
>
> Voila!
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Fri, Jul 11, 2014 at 10:15 AM, Sven Meier <sv...@meiers.net> wrote:
>
>> an AjaxEventBehavior, but I don't have a component to attach it to.
>>>
>>
>> You have a page, don't you?
>> Otherwise you can request a resource via Ajax too.
>>
>> Regards
>> Sven
>>
>>
>>
>>
>> On 07/11/2014 02:47 AM, Joachim Schrod wrote:
>>
>>> Hi,
>>>
>>> In a Wicket application I have JQuery code that triggers after a
>>> certain time of user inactivity. I need to tell server-side about
>>> that inactivity. No problem, I thought, just issue an AJAX request.
>>>
>>> Well, looking around I found several possibilities to do that as a
>>> side effect, but no component at first hand that is made up for
>>> that task. I thought that's strange, it doesn't sound as a remote
>>> demand. So my question is about best practice for this use case.
>>>
>>> Namely: I have a change on client-side that I want to communicate
>>> to server-side. No changes in DOM are associated. Just like
>>> triggering an AjaxLink where onClick() does not call any methods on
>>> target. I know about the JavaScript function Wicket.Ajax.ajax() and
>>> its arguments. My problem is choosing the right component server-side.
>>>
>>> An AjaxEventBehavior would be the right thing, but I don't have a
>>> component to attach it to. The worst solution would be a hidden
>>> AjaxLink. IMO I simply need to establish a listener URL that
>>> triggers some method, an URL that I can use in a Wicket.Ajax.ajax()
>>> call -- but I don't find the Wicket component that supplies me with
>>> that functionality.
>>>
>>> How can I do that?
>>> Or is my focus on the Wicket.Ajax.ajax() JS interface blocking my
>>> view on another solution that's better?
>>>
>>> I know my way around Wicket's code and documentation. Thus, a hint
>>> like "start with class XYZ" would be very much appreciated, I don't
>>> need a full solution with code. I'm surely missing something
>>> obvious and would severely appreciate any help or tips.
>>>
>>> Cheers,
>>> Joachim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jschrod@acm.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Best practice sought: Register client change at server
Posted by Martin Grigorov <mg...@apache.org>.
page.add(new AjaxEventBehavior("my-special-event") {...});
in JS code: jQuery(document).triggerHandler('my-special-event');
Voila!
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Fri, Jul 11, 2014 at 10:15 AM, Sven Meier <sv...@meiers.net> wrote:
> an AjaxEventBehavior, but I don't have a component to attach it to.
>>
>
> You have a page, don't you?
> Otherwise you can request a resource via Ajax too.
>
> Regards
> Sven
>
>
>
>
> On 07/11/2014 02:47 AM, Joachim Schrod wrote:
>
>> Hi,
>>
>> In a Wicket application I have JQuery code that triggers after a
>> certain time of user inactivity. I need to tell server-side about
>> that inactivity. No problem, I thought, just issue an AJAX request.
>>
>> Well, looking around I found several possibilities to do that as a
>> side effect, but no component at first hand that is made up for
>> that task. I thought that's strange, it doesn't sound as a remote
>> demand. So my question is about best practice for this use case.
>>
>> Namely: I have a change on client-side that I want to communicate
>> to server-side. No changes in DOM are associated. Just like
>> triggering an AjaxLink where onClick() does not call any methods on
>> target. I know about the JavaScript function Wicket.Ajax.ajax() and
>> its arguments. My problem is choosing the right component server-side.
>>
>> An AjaxEventBehavior would be the right thing, but I don't have a
>> component to attach it to. The worst solution would be a hidden
>> AjaxLink. IMO I simply need to establish a listener URL that
>> triggers some method, an URL that I can use in a Wicket.Ajax.ajax()
>> call -- but I don't find the Wicket component that supplies me with
>> that functionality.
>>
>> How can I do that?
>> Or is my focus on the Wicket.Ajax.ajax() JS interface blocking my
>> view on another solution that's better?
>>
>> I know my way around Wicket's code and documentation. Thus, a hint
>> like "start with class XYZ" would be very much appreciated, I don't
>> need a full solution with code. I'm surely missing something
>> obvious and would severely appreciate any help or tips.
>>
>> Cheers,
>> Joachim
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Best practice sought: Register client change at server
Posted by Sven Meier <sv...@meiers.net>.
> an AjaxEventBehavior, but I don't have a component to attach it to.
You have a page, don't you?
Otherwise you can request a resource via Ajax too.
Regards
Sven
On 07/11/2014 02:47 AM, Joachim Schrod wrote:
> Hi,
>
> In a Wicket application I have JQuery code that triggers after a
> certain time of user inactivity. I need to tell server-side about
> that inactivity. No problem, I thought, just issue an AJAX request.
>
> Well, looking around I found several possibilities to do that as a
> side effect, but no component at first hand that is made up for
> that task. I thought that's strange, it doesn't sound as a remote
> demand. So my question is about best practice for this use case.
>
> Namely: I have a change on client-side that I want to communicate
> to server-side. No changes in DOM are associated. Just like
> triggering an AjaxLink where onClick() does not call any methods on
> target. I know about the JavaScript function Wicket.Ajax.ajax() and
> its arguments. My problem is choosing the right component server-side.
>
> An AjaxEventBehavior would be the right thing, but I don't have a
> component to attach it to. The worst solution would be a hidden
> AjaxLink. IMO I simply need to establish a listener URL that
> triggers some method, an URL that I can use in a Wicket.Ajax.ajax()
> call -- but I don't find the Wicket component that supplies me with
> that functionality.
>
> How can I do that?
> Or is my focus on the Wicket.Ajax.ajax() JS interface blocking my
> view on another solution that's better?
>
> I know my way around Wicket's code and documentation. Thus, a hint
> like "start with class XYZ" would be very much appreciated, I don't
> need a full solution with code. I'm surely missing something
> obvious and would severely appreciate any help or tips.
>
> Cheers,
> Joachim
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Best practice sought: Register client change at server
Posted by Joachim Schrod <js...@acm.org>.
On 07/11/14 04:44, Ernesto Reinaldo Barreiro wrote:
> On Fri, Jul 11, 2014 at 2:47 AM, Joachim Schrod <js...@acm.org> wrote:
>>
>> An AjaxEventBehavior would be the right thing, but I don't have a
>> component to attach it to. The worst solution would be a hidden
>> AjaxLink. IMO I simply need to establish a listener URL that
>> triggers some method, an URL that I can use in a Wicket.Ajax.ajax()
>> call -- but I don't find the Wicket component that supplies me with
>> that functionality.
>
> Maybe this can be of some help
>
> https://github.com/reiern70/antilia-bits/tree/master/client-sign-out-parent
Yes, very illustrating.
While I eventually ended up with a different solution, this code
showed me an alternative way that I will keep in mind for the future.
Joachim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jschrod@acm.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Best practice sought: Register client change at server
Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Maybe this can be of some help
https://github.com/reiern70/antilia-bits/tree/master/client-sign-out-parent
On Fri, Jul 11, 2014 at 2:47 AM, Joachim Schrod <js...@acm.org> wrote:
> Hi,
>
> In a Wicket application I have JQuery code that triggers after a
> certain time of user inactivity. I need to tell server-side about
> that inactivity. No problem, I thought, just issue an AJAX request.
>
> Well, looking around I found several possibilities to do that as a
> side effect, but no component at first hand that is made up for
> that task. I thought that's strange, it doesn't sound as a remote
> demand. So my question is about best practice for this use case.
>
> Namely: I have a change on client-side that I want to communicate
> to server-side. No changes in DOM are associated. Just like
> triggering an AjaxLink where onClick() does not call any methods on
> target. I know about the JavaScript function Wicket.Ajax.ajax() and
> its arguments. My problem is choosing the right component server-side.
>
> An AjaxEventBehavior would be the right thing, but I don't have a
> component to attach it to. The worst solution would be a hidden
> AjaxLink. IMO I simply need to establish a listener URL that
> triggers some method, an URL that I can use in a Wicket.Ajax.ajax()
> call -- but I don't find the Wicket component that supplies me with
> that functionality.
>
> How can I do that?
> Or is my focus on the Wicket.Ajax.ajax() JS interface blocking my
> view on another solution that's better?
>
> I know my way around Wicket's code and documentation. Thus, a hint
> like "start with class XYZ" would be very much appreciated, I don't
> need a full solution with code. I'm surely missing something
> obvious and would severely appreciate any help or tips.
>
> Cheers,
> Joachim
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Joachim Schrod, Roedermark, Germany
> Email: jschrod@acm.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Regards - Ernesto Reinaldo Barreiro