You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martijn Dashorst <ma...@gmail.com> on 2016/03/29 10:14:04 UTC

Stateless AJAX in Wicket

All,

I've done a small experiment with stateless ajax based on the code
from Jolira and ported it to wicket 7.

It appears that stateless ajax actually works, and the code doesn't
look all that jarring to me. I understand that providing this
out-of-the-box, and as a default implementation is dangerous.

https://github.com/jolira/wicket-stateless/blob/master/stateless/src/main/java/com/google/code/joliratools/StatelessAjaxFormComponentUpdatingBehavior.java

The only thing I had to fix was adding the following onBind method,
because Wicket's standard implementation doesn't perform this when
getStatelessHint() returns true:

@Override
protected void onBind()
{
    super.onBind();
    getFormComponent().getBehaviorId(this);
}

The other snag I ran into was that the components you want to replace
need to have a static markupId (not generated by Wicket).

Is this something we want to add to wicket proper?

Martijn


-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

Re: Stateless AJAX in Wicket

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Mar 29, 2016 at 2:35 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Yes, Jolira's code has been moved to Wicketstuff in early 6.x days.
>
> Stateless Ajax works for the simple cases but would fail for the use case
> I've explained here: http://markmail.org/message/d7xuiao44owuyf56.
> Although I guess the same is valid for non-Ajax stateless link too.
>

Someone just verified my theory: http://stackoverflow.com/q/36450085/497381


>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Mar 29, 2016 at 10:28 AM, Andrea Del Bene <an...@gmail.com>
> wrote:
>
>> I think this code has been already integrated into wicketstuff module
>> stateless :
>> https://github.com/wicketstuff/core/tree/master/stateless-parent
>> On 29 Mar 2016 10:14, "Martijn Dashorst" <ma...@gmail.com>
>> wrote:
>>
>> > All,
>> >
>> > I've done a small experiment with stateless ajax based on the code
>> > from Jolira and ported it to wicket 7.
>> >
>> > It appears that stateless ajax actually works, and the code doesn't
>> > look all that jarring to me. I understand that providing this
>> > out-of-the-box, and as a default implementation is dangerous.
>> >
>> >
>> >
>> https://github.com/jolira/wicket-stateless/blob/master/stateless/src/main/java/com/google/code/joliratools/StatelessAjaxFormComponentUpdatingBehavior.java
>> >
>> > The only thing I had to fix was adding the following onBind method,
>> > because Wicket's standard implementation doesn't perform this when
>> > getStatelessHint() returns true:
>> >
>> > @Override
>> > protected void onBind()
>> > {
>> >     super.onBind();
>> >     getFormComponent().getBehaviorId(this);
>> > }
>> >
>> > The other snag I ran into was that the components you want to replace
>> > need to have a static markupId (not generated by Wicket).
>> >
>> > Is this something we want to add to wicket proper?
>> >
>> > Martijn
>> >
>> >
>> > --
>> > Become a Wicket expert, learn from the best: http://wicketinaction.com
>> >
>>
>
>

Re: Stateless AJAX in Wicket

Posted by Martin Grigorov <mg...@apache.org>.
Yes, Jolira's code has been moved to Wicketstuff in early 6.x days.

Stateless Ajax works for the simple cases but would fail for the use case
I've explained here: http://markmail.org/message/d7xuiao44owuyf56. Although
I guess the same is valid for non-Ajax stateless link too.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Mar 29, 2016 at 10:28 AM, Andrea Del Bene <an...@gmail.com>
wrote:

> I think this code has been already integrated into wicketstuff module
> stateless :
> https://github.com/wicketstuff/core/tree/master/stateless-parent
> On 29 Mar 2016 10:14, "Martijn Dashorst" <ma...@gmail.com>
> wrote:
>
> > All,
> >
> > I've done a small experiment with stateless ajax based on the code
> > from Jolira and ported it to wicket 7.
> >
> > It appears that stateless ajax actually works, and the code doesn't
> > look all that jarring to me. I understand that providing this
> > out-of-the-box, and as a default implementation is dangerous.
> >
> >
> >
> https://github.com/jolira/wicket-stateless/blob/master/stateless/src/main/java/com/google/code/joliratools/StatelessAjaxFormComponentUpdatingBehavior.java
> >
> > The only thing I had to fix was adding the following onBind method,
> > because Wicket's standard implementation doesn't perform this when
> > getStatelessHint() returns true:
> >
> > @Override
> > protected void onBind()
> > {
> >     super.onBind();
> >     getFormComponent().getBehaviorId(this);
> > }
> >
> > The other snag I ran into was that the components you want to replace
> > need to have a static markupId (not generated by Wicket).
> >
> > Is this something we want to add to wicket proper?
> >
> > Martijn
> >
> >
> > --
> > Become a Wicket expert, learn from the best: http://wicketinaction.com
> >
>

Re: Stateless AJAX in Wicket

Posted by Andrea Del Bene <an...@gmail.com>.
I think this code has been already integrated into wicketstuff module
stateless : https://github.com/wicketstuff/core/tree/master/stateless-parent
On 29 Mar 2016 10:14, "Martijn Dashorst" <ma...@gmail.com> wrote:

> All,
>
> I've done a small experiment with stateless ajax based on the code
> from Jolira and ported it to wicket 7.
>
> It appears that stateless ajax actually works, and the code doesn't
> look all that jarring to me. I understand that providing this
> out-of-the-box, and as a default implementation is dangerous.
>
>
> https://github.com/jolira/wicket-stateless/blob/master/stateless/src/main/java/com/google/code/joliratools/StatelessAjaxFormComponentUpdatingBehavior.java
>
> The only thing I had to fix was adding the following onBind method,
> because Wicket's standard implementation doesn't perform this when
> getStatelessHint() returns true:
>
> @Override
> protected void onBind()
> {
>     super.onBind();
>     getFormComponent().getBehaviorId(this);
> }
>
> The other snag I ran into was that the components you want to replace
> need to have a static markupId (not generated by Wicket).
>
> Is this something we want to add to wicket proper?
>
> Martijn
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>

Re: Stateless AJAX in Wicket

Posted by Martin Grigorov <mg...@apache.org>.
https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+7.0#IdeasforWicket7.0-Betterstatelesssupport

The idea is not new. It just needs someone to push it!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Mar 29, 2016 at 4:37 PM, andrea del bene <an...@gmail.com>
wrote:

>
>
> In any case, +1 to add stateless AJAX to Wicket. I think it would be
> appreciated.
>
> All,
>>
>> I've done a small experiment with stateless ajax based on the code
>> from Jolira and ported it to wicket 7.
>>
>> It appears that stateless ajax actually works, and the code doesn't
>> look all that jarring to me. I understand that providing this
>> out-of-the-box, and as a default implementation is dangerous.
>>
>>
>> https://github.com/jolira/wicket-stateless/blob/master/stateless/src/main/java/com/google/code/joliratools/StatelessAjaxFormComponentUpdatingBehavior.java
>>
>> The only thing I had to fix was adding the following onBind method,
>> because Wicket's standard implementation doesn't perform this when
>> getStatelessHint() returns true:
>>
>> @Override
>> protected void onBind()
>> {
>>      super.onBind();
>>      getFormComponent().getBehaviorId(this);
>> }
>>
>> The other snag I ran into was that the components you want to replace
>> need to have a static markupId (not generated by Wicket).
>>
>> Is this something we want to add to wicket proper?
>>
>> Martijn
>>
>>
>>
>

Re: Stateless AJAX in Wicket

Posted by andrea del bene <an...@gmail.com>.

In any case, +1 to add stateless AJAX to Wicket. I think it would be 
appreciated.
> All,
>
> I've done a small experiment with stateless ajax based on the code
> from Jolira and ported it to wicket 7.
>
> It appears that stateless ajax actually works, and the code doesn't
> look all that jarring to me. I understand that providing this
> out-of-the-box, and as a default implementation is dangerous.
>
> https://github.com/jolira/wicket-stateless/blob/master/stateless/src/main/java/com/google/code/joliratools/StatelessAjaxFormComponentUpdatingBehavior.java
>
> The only thing I had to fix was adding the following onBind method,
> because Wicket's standard implementation doesn't perform this when
> getStatelessHint() returns true:
>
> @Override
> protected void onBind()
> {
>      super.onBind();
>      getFormComponent().getBehaviorId(this);
> }
>
> The other snag I ran into was that the components you want to replace
> need to have a static markupId (not generated by Wicket).
>
> Is this something we want to add to wicket proper?
>
> Martijn
>
>