You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Geoff Callender <ge...@gmail.com> on 2008/09/06 14:48:51 UTC

T5: AJAX ActionLink exception if clicked as page loads

Is this a known problem? Is there a known solution?

I have a page with 2 ActionLinks - the first link updates the whole  
page; the second link specifies a zone.

If you click on the two links in quick succession then an exception is  
thrown.  Alternatively, just Reload the page and click on the second  
link before the page has finished reloading and you'll get the same  
exception.

Here's the page, with source: http://202.177.217.122:8080/jumpstart/examples/javascript/ajax

Here's the exception:

A component event handler method returned the value  
org.apache.tapestry5.internal.structure.BlockImpl@80937b. Return type  
org.apache.tapestry5.internal.structure.BlockImpl can not be handled.  
Configured return types are java.lang.Class, java.lang.String,  
java.net.URL, org.apache.tapestry5.Link,  
org.apache.tapestry5.StreamResponse,  
org.apache.tapestry5.runtime.Component.

Geoff

Re: T5: AJAX ActionLink exception if clicked as page loads

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi Geoff,

Tapestry doesn't hook up zones etc. until the DOM is loaded, so the link 
isn't an AJAX link at the time you click it.

You can check Request#isXhr in your event handler to see if it's an AJAX 
request - if it's not you can't return a Block, so you'll have to figure 
out another way to do what needs to be done.

-Filip

On 2008-09-06 14:48, Geoff Callender wrote:
> Is this a known problem? Is there a known solution?
> 
> I have a page with 2 ActionLinks - the first link updates the whole 
> page; the second link specifies a zone.
> 
> If you click on the two links in quick succession then an exception is 
> thrown.  Alternatively, just Reload the page and click on the second 
> link before the page has finished reloading and you'll get the same 
> exception.
> 
> Here's the page, with source: 
> http://202.177.217.122:8080/jumpstart/examples/javascript/ajax
> 
> Here's the exception:
> 
> A component event handler method returned the value 
> org.apache.tapestry5.internal.structure.BlockImpl@80937b. Return type 
> org.apache.tapestry5.internal.structure.BlockImpl can not be handled. 
> Configured return types are java.lang.Class, java.lang.String, 
> java.net.URL, org.apache.tapestry5.Link, 
> org.apache.tapestry5.StreamResponse, 
> org.apache.tapestry5.runtime.Component.
> 
> Geoff

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


Re: T5: AJAX ActionLink exception if clicked as page loads

Posted by Geoff Callender <ge...@gmail.com>.
See https://issues.apache.org/jira/browse/TAP5-1 .
Perhaps you should add your comments and maybe even re-open it?

On 20/11/2008, at 7:28 PM, Inge Solvoll wrote:

> I ran into this problem myself.
>
> Is it possible to listen for an event that says "Tapestry javascript  
> has
> finished initializing the page"? The scenario of users clicking  
> links before
> they are "decorated" with ajax javascript is very common, so there  
> should be
> a built-in best-practice solution for this. I know I could solve it  
> server
> side by checking for isXHR, but I don't think the case of users  
> being faster
> thinkers than the CPU should be a natural part of my graceful  
> degredation.
> Users without proper XHR support should.
>
> I would like to be able to hide my links until they are ajax- 
> enabled. Or
> implement some other trick to prevent this bug from happening. But I  
> guess
> this would be pretty hard if I'm not able to track the status of the
> Tapestry init script?
>
> I could just use the Prototype dom loaded event, and add a 2 second  
> timeout
> to be relatively sure, but it ain't exactly pretty :)
>
> Regards
> Inge
> On Mon, Sep 8, 2008 at 2:58 PM, luna_guo <gh...@163.com> wrote:
>
>>
>> Geoff
>> It's ok to return a block object in a action handler method,but you  
>> can't
>> use the type Block,it will throw exceptions.You should use Object  
>> instead.
>>
>> /luna
>> --
>> View this message in context:
>> http://www.nabble.com/T5%3A-AJAX-ActionLink-exception-if-clicked-as-page-loads-tp19346336p19372125.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
>>
>>


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


Re: T5: AJAX ActionLink exception if clicked as page loads

Posted by Inge Solvoll <in...@gmail.com>.
I ran into this problem myself.

Is it possible to listen for an event that says "Tapestry javascript has
finished initializing the page"? The scenario of users clicking links before
they are "decorated" with ajax javascript is very common, so there should be
a built-in best-practice solution for this. I know I could solve it server
side by checking for isXHR, but I don't think the case of users being faster
thinkers than the CPU should be a natural part of my graceful degredation.
Users without proper XHR support should.

I would like to be able to hide my links until they are ajax-enabled. Or
implement some other trick to prevent this bug from happening. But I guess
this would be pretty hard if I'm not able to track the status of the
Tapestry init script?

I could just use the Prototype dom loaded event, and add a 2 second timeout
to be relatively sure, but it ain't exactly pretty :)

Regards
Inge
On Mon, Sep 8, 2008 at 2:58 PM, luna_guo <gh...@163.com> wrote:

>
> Geoff
> It's ok to return a block object in a action handler method,but you can't
> use the type Block,it will throw exceptions.You should use Object instead.
>
> /luna
> --
> View this message in context:
> http://www.nabble.com/T5%3A-AJAX-ActionLink-exception-if-clicked-as-page-loads-tp19346336p19372125.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: T5: AJAX ActionLink exception if clicked as page loads

Posted by luna_guo <gh...@163.com>.
Geoff
It's ok to return a block object in a action handler method,but you can't
use the type Block,it will throw exceptions.You should use Object instead.

/luna
-- 
View this message in context: http://www.nabble.com/T5%3A-AJAX-ActionLink-exception-if-clicked-as-page-loads-tp19346336p19372125.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