You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Lewis <ch...@bellsouth.net> on 2008/03/19 17:14:16 UTC

Re: Component event handlers

What is the declared return type of your method? It should be Object,
and not BlockImpl.

José Paumard wrote:
> Hi all,
>
> Everytime I try to return an injected block in an event handler
> method, I get an error message, telling me that BlockImpl is not a
> valid returned value. From the nightly generated docs, this is
> supposed to work. Has anyone experienced this too ?
>
> Thank you,
>
> José
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For
> additional commands, e-mail: users-help@tapestry.apache.org 

Re: AW: Component event handlers

Posted by Howard Lewis Ship <hl...@gmail.com>.
It's not a hash code, its a unique id.  Because Tapestry is having to
render the page piecemeil, across a series of Ajax requests, it can't
know what ids are already taken when it is trying to generate unique
DOM ids for elements, therefore, an Ajax request gets a namespace:
this timestamp as a hex string.  The namespace is encororated into any
ids generated by PageRenderSupport during an Ajax partial markup
render.

On Wed, Mar 19, 2008 at 11:43 AM, José Paumard <Jo...@orange.fr> wrote:
>
>  It is indeed an Ajax request, the t:zone XML attribute is there, so there
> is no problem with that.
>
>  From what I see, T5 sometimes maps a TML
>
>  <t:zone t:id="someZone"></t:zone>
>
>  as (seen by inspecting the DOM)
>
>  <div id="someZone:118c853e048" class="t-zone"/>
>
>  or as
>
>  <div id="someZone" class="t-zone"/>
>
>  And in the 1st case, clicking on the link refresh the page, with an error
> message.
>  When I try to narrow things, it seems to me that when you refresh a Zone A
> that contains another zone B, then the id of B is added this hashCode like
> stuff.
>
>  I hope Howard could enlighten us on that point ?
>
>  Thank you,
>
>  José
>
>
>
>  Ted Steen a écrit :
>
>  The error you get is probably due to the fact that it is not an ajax
> request.
> you can only return blocks from event methods when making ajax requests.
>
> you have to make the request with Ajax.request(...) or by using
> tapestry default ajax mechanism. (<t:form t:zone="....">...)
>
> hope it helps!
>
> 2008/3/19, Martin Kersten <Ma...@mercateo.com>:
>
>
>  I see. When I read the AJAX documentation correctly your code snippet
> should be on the save side.
>  Sorry but I can't see anything wrong.
>
>
>  Cheers,
>
>  Martin (Kersten)
>
>
>  ________________________________
>
>  Von: José Paumard [mailto:Jose.Paumard@orange.fr]
>
> Gesendet: Mittwoch, 19. März 2008 17:33
>  An: Tapestry users
>  Betreff: Re: AW: Component event handlers
>
>
>
>  Code snippets are very basic :
>
>  In the tml :
>
>  <t:eventLink t:event="someEvent" t:zone="someZone">click me</t:eventLink>
>
>  <t:block t:id="someBlock">
>  <t:some.component/>
>  </t:block>
>
>
>  In the class :
>
>  @Inject
>  private Block someBlock ;
>
>  @OnEvent(value="someEvent")
>  Block clickMe() {
>  return someBlock ;
>  }
>
>  What I would expect is to see the content of the block in the div
> "someZone", but I have an exception instead.
>
>  José
>
>  Martin Kersten a écrit :
>
>  Sounds like onActivate? What do you try to do? Can you give us the exact
> case (event type). Code Snippet?
>
>  ________________________________
>
>  Von: José Paumard [mailto:Jose.Paumard@orange.fr]
>  Gesendet: Mittwoch, 19. März 2008 17:18
>  An: Tapestry users
>  Betreff: Re: Component event handlers
>
>
>  Hello Chris,
>
>  Thank you for your fast answer.
>
>  It is Block (not BlockImpl, this class is in the internals of T5, so using
> it is not recommended). I switched to Object, but it didnt change anything.
> Here is the exact error message :
>
>  A component event handler method returned the value
> org.apache.tapestry.internal.structure.BlockImpl@1e7d12b. Return type
> org.apache.tapestry.internal.structure.BlockImpl can not be handled.
> Configured return types are java.lang.Class, java.lang.String, java.net.URL,
> org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
> org.apache.tapestry.runtime.Component.
>
>  Chris Lewis a écrit :
>
>  What is the declared return type of your method? It should be Object,
>  and not BlockImpl.
>
>  José Paumard wrote:
>
>
>  Hi all,
>
>  Everytime I try to return an injected block in an event handler
>  method, I get an error message, telling me that BlockImpl is not a
>  valid returned value. From the nightly generated docs, this is
>  supposed to work. Has anyone experienced this too ?
>
>  Thank you,
>
>  José
>  ---------------------------------------------------------------------
>  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
>
>
>
>  --------------------------------------------------------------------- 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



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: AW: Component event handlers

Posted by Ted Steen <te...@gmail.com>.
The error you get is probably due to the fact that it is not an ajax request.
you can only return blocks from event methods when making ajax requests.

you have to make the request with Ajax.request(...) or by using
tapestry default ajax mechanism. (<t:form t:zone="....">...)

hope it helps!

2008/3/19, Martin Kersten <Ma...@mercateo.com>:
> I see. When I read the AJAX documentation correctly your code snippet should be on the save side.
>  Sorry but I can't see anything wrong.
>
>
>  Cheers,
>
>  Martin (Kersten)
>
>
>  ________________________________
>
>  Von: José Paumard [mailto:Jose.Paumard@orange.fr]
>
> Gesendet: Mittwoch, 19. März 2008 17:33
>  An: Tapestry users
>  Betreff: Re: AW: Component event handlers
>
>
>
>  Code snippets are very basic :
>
>  In the tml :
>
>  <t:eventLink t:event="someEvent" t:zone="someZone">click me</t:eventLink>
>
>  <t:block t:id="someBlock">
>     <t:some.component/>
>  </t:block>
>
>
>  In the class :
>
>     @Inject
>     private Block someBlock ;
>
>     @OnEvent(value="someEvent")
>     Block clickMe() {
>         return someBlock ;
>     }
>
>  What I would expect is to see the content of the block in the div "someZone", but I have an exception instead.
>
>  José
>
>  Martin Kersten a écrit :
>
>         Sounds like onActivate? What do you try to do? Can you give us the exact case (event type). Code Snippet?
>
>         ________________________________
>
>         Von: José Paumard [mailto:Jose.Paumard@orange.fr]
>         Gesendet: Mittwoch, 19. März 2008 17:18
>         An: Tapestry users
>         Betreff: Re: Component event handlers
>
>
>         Hello Chris,
>
>         Thank you for your fast answer.
>
>         It is Block (not BlockImpl, this class is in the internals of T5, so using it is not recommended). I switched to Object, but it didnt change anything. Here is the exact error message :
>
>         A component event handler method returned the value org.apache.tapestry.internal.structure.BlockImpl@1e7d12b. Return type org.apache.tapestry.internal.structure.BlockImpl can not be handled. Configured return types are java.lang.Class, java.lang.String, java.net.URL, org.apache.tapestry.Link, org.apache.tapestry.StreamResponse, org.apache.tapestry.runtime.Component.
>
>         Chris Lewis a écrit :
>
>                 What is the declared return type of your method? It should be Object,
>                 and not BlockImpl.
>
>                 José Paumard wrote:
>
>
>                         Hi all,
>
>                         Everytime I try to return an injected block in an event handler
>                         method, I get an error message, telling me that BlockImpl is not a
>                         valid returned value. From the nightly generated docs, this is
>                         supposed to work. Has anyone experienced this too ?
>
>                         Thank you,
>
>                         José
>                         ---------------------------------------------------------------------
>                         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
>
>
>
>  --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org For additional commands, e-mail: users-help@tapestry.apache.org
>


-- 
/ted

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


AW: AW: Component event handlers

Posted by Martin Kersten <Ma...@mercateo.com>.
I see. When I read the AJAX documentation correctly your code snippet should be on the save side.
Sorry but I can't see anything wrong.
 
 
Cheers,
 
Martin (Kersten)

________________________________

Von: José Paumard [mailto:Jose.Paumard@orange.fr] 
Gesendet: Mittwoch, 19. März 2008 17:33
An: Tapestry users
Betreff: Re: AW: Component event handlers


Code snippets are very basic :

In the tml : 

<t:eventLink t:event="someEvent" t:zone="someZone">click me</t:eventLink>

<t:block t:id="someBlock">
    <t:some.component/>
</t:block>


In the class : 

    @Inject
    private Block someBlock ;

    @OnEvent(value="someEvent")
    Block clickMe() {
        return someBlock ;
    }

What I would expect is to see the content of the block in the div "someZone", but I have an exception instead. 

José

Martin Kersten a écrit : 

	Sounds like onActivate? What do you try to do? Can you give us the exact case (event type). Code Snippet?
	
	________________________________
	
	Von: José Paumard [mailto:Jose.Paumard@orange.fr] 
	Gesendet: Mittwoch, 19. März 2008 17:18
	An: Tapestry users
	Betreff: Re: Component event handlers
	
	
	Hello Chris, 
	
	Thank you for your fast answer. 
	
	It is Block (not BlockImpl, this class is in the internals of T5, so using it is not recommended). I switched to Object, but it didnt change anything. Here is the exact error message : 
	
	A component event handler method returned the value org.apache.tapestry.internal.structure.BlockImpl@1e7d12b. Return type org.apache.tapestry.internal.structure.BlockImpl can not be handled. Configured return types are java.lang.Class, java.lang.String, java.net.URL, org.apache.tapestry.Link, org.apache.tapestry.StreamResponse, org.apache.tapestry.runtime.Component.
	
	Chris Lewis a écrit : 
	
		What is the declared return type of your method? It should be Object,
		and not BlockImpl.
		
		José Paumard wrote:
		  
	
			Hi all,
			
			Everytime I try to return an injected block in an event handler
			method, I get an error message, telling me that BlockImpl is not a
			valid returned value. From the nightly generated docs, this is
			supposed to work. Has anyone experienced this too ?
			
			Thank you,
			
			José
			---------------------------------------------------------------------
			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 
	
	  

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

AW: Component event handlers

Posted by Martin Kersten <Ma...@mercateo.com>.
Sounds like onActivate? What do you try to do? Can you give us the exact case (event type). Code Snippet?

________________________________

Von: José Paumard [mailto:Jose.Paumard@orange.fr] 
Gesendet: Mittwoch, 19. März 2008 17:18
An: Tapestry users
Betreff: Re: Component event handlers


Hello Chris, 

Thank you for your fast answer. 

It is Block (not BlockImpl, this class is in the internals of T5, so using it is not recommended). I switched to Object, but it didnt change anything. Here is the exact error message : 

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

Chris Lewis a écrit : 

	What is the declared return type of your method? It should be Object,
	and not BlockImpl.
	
	José Paumard wrote:
	  

		Hi all,
		
		Everytime I try to return an injected block in an event handler
		method, I get an error message, telling me that BlockImpl is not a
		valid returned value. From the nightly generated docs, this is
		supposed to work. Has anyone experienced this too ?
		
		Thank you,
		
		José
		---------------------------------------------------------------------
		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