You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Daniel Soneira <da...@joyn-it.at> on 2010/08/18 17:51:32 UTC

1.5-M1 - AjaxRequestTarget.get() returning null within AjaxLink#onClick

  Why does AjaxRequestTarget.get() not behave like in 1.4.10?

Code:
--------------------------
...
new AjaxLink<Void>("link") {
     @Override
     public void onClick(AjaxRequestTarget target) {
         feedback("link clicked");
     }
}

public void feedback(String message) {
      info(message);
      AjaxRequestTarget target = AjaxRequestTarget.get();
      if (target != null) {
          target.addComponent(get("feedback"));
      }
}
...
--------------------------

In previous versions of Wicket this code worked.
Now target is null and therefore the feedback panel is not re-rendered.
Debugging AjaxRequestTarget.get shows that the active request handler is 
a ListenerInterfaceRequestHandler with an AjaxRequestTarget as next 
"scheduled" handler.

Yes, I am aware that I could be using the target as a method parameter 
but I am curious to know the reason for this behavior. I've seen some 
code that makes similar use
of AjaxRequestTarget.get (like the inmethod grid).

I have not found anything in the migration guide / wiki regarding this 
issue.

Kind regards,
Daniel
--
www.joyn-it.at

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


Re: 1.5-M1 - AjaxRequestTarget.get() returning null within AjaxLink#onClick

Posted by Daniel Soneira <da...@joyn-it.at>.
  There you go:
https://issues.apache.org/jira/browse/WICKET-3001

Kind regards,
Daniel

On 18.08.2010 18:15, Igor Vaynberg wrote:
> sounds like a bug, open a jira ticket please.
>
> -igor
>
> On Wed, Aug 18, 2010 at 8:51 AM, Daniel Soneira
> <da...@joyn-it.at>  wrote:
>>   Why does AjaxRequestTarget.get() not behave like in 1.4.10?
>>
>> Code:
>> --------------------------
>> ...
>> new AjaxLink<Void>("link") {
>>     @Override
>>     public void onClick(AjaxRequestTarget target) {
>>         feedback("link clicked");
>>     }
>> }
>>
>> public void feedback(String message) {
>>      info(message);
>>      AjaxRequestTarget target = AjaxRequestTarget.get();
>>      if (target != null) {
>>          target.addComponent(get("feedback"));
>>      }
>> }
>> ...
>> --------------------------
>>
>> In previous versions of Wicket this code worked.
>> Now target is null and therefore the feedback panel is not re-rendered.
>> Debugging AjaxRequestTarget.get shows that the active request handler is a
>> ListenerInterfaceRequestHandler with an AjaxRequestTarget as next
>> "scheduled" handler.
>>
>> Yes, I am aware that I could be using the target as a method parameter but I
>> am curious to know the reason for this behavior. I've seen some code that
>> makes similar use
>> of AjaxRequestTarget.get (like the inmethod grid).
>>
>> I have not found anything in the migration guide / wiki regarding this
>> issue.
>>
>> Kind regards,
>> Daniel
>> --
>> www.joyn-it.at
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: 1.5-M1 - AjaxRequestTarget.get() returning null within AjaxLink#onClick

Posted by Igor Vaynberg <ig...@gmail.com>.
sounds like a bug, open a jira ticket please.

-igor

On Wed, Aug 18, 2010 at 8:51 AM, Daniel Soneira
<da...@joyn-it.at> wrote:
>  Why does AjaxRequestTarget.get() not behave like in 1.4.10?
>
> Code:
> --------------------------
> ...
> new AjaxLink<Void>("link") {
>    @Override
>    public void onClick(AjaxRequestTarget target) {
>        feedback("link clicked");
>    }
> }
>
> public void feedback(String message) {
>     info(message);
>     AjaxRequestTarget target = AjaxRequestTarget.get();
>     if (target != null) {
>         target.addComponent(get("feedback"));
>     }
> }
> ...
> --------------------------
>
> In previous versions of Wicket this code worked.
> Now target is null and therefore the feedback panel is not re-rendered.
> Debugging AjaxRequestTarget.get shows that the active request handler is a
> ListenerInterfaceRequestHandler with an AjaxRequestTarget as next
> "scheduled" handler.
>
> Yes, I am aware that I could be using the target as a method parameter but I
> am curious to know the reason for this behavior. I've seen some code that
> makes similar use
> of AjaxRequestTarget.get (like the inmethod grid).
>
> I have not found anything in the migration guide / wiki regarding this
> issue.
>
> Kind regards,
> Daniel
> --
> www.joyn-it.at
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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