You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by dsarosi <ds...@hotmail.com> on 2009/01/06 10:59:50 UTC

Using OnEvent("activate") to render block

I'm trying to render a block instead of the page when using an ajax call. 
This way, I can have a low-bandwidth and a high-bandwith (AJAX enabled
site).  

@Inject
@Property
private Block _content;

@OnEvent("activate")
Object activate()
{
    if (req.isXHR()) 
        return _content 
    Object page = validateUserSession();
    retrieveMailSetting();
    return page;
}

However, when I make the ajax call, i get the following error;

A component event handler
 method returned the value Block[content within mail/Compose, at
context:mail/Compose.tml, line 2, column
 25]. 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.


Any suggestions?  
-- 
View this message in context: http://www.nabble.com/Using-OnEvent%28%22activate%22%29-to-render-block-tp21307640p21307640.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: Using OnEvent("activate") to render block

Posted by Ulrich Stärk <ul...@spielviel.de>.
I'm not 100% sure but I think returning a block only works with Zones. In all other cases, the rules 
as described here http://tapestry.apache.org/tapestry5/guide/pagenav.html apply.

Cheers,

Uli

dsarosi schrieb:
> I'm trying to render a block instead of the page when using an ajax call. 
> This way, I can have a low-bandwidth and a high-bandwith (AJAX enabled
> site).  
> 
> @Inject
> @Property
> private Block _content;
> 
> @OnEvent("activate")
> Object activate()
> {
>     if (req.isXHR()) 
>         return _content 
>     Object page = validateUserSession();
>     retrieveMailSetting();
>     return page;
> }
> 
> However, when I make the ajax call, i get the following error;
> 
> A component event handler
>  method returned the value Block[content within mail/Compose, at
> context:mail/Compose.tml, line 2, column
>  25]. 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.
> 
> 
> Any suggestions?  


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