You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Casey Link <ca...@outskirtslabs.com> on 2015/06/18 19:47:51 UTC

Eventlink event "was not handled; you must provide a matching event handler method"

Hi again,


Big thanks to Thiago and everyone else who answers questions on this list.

I have a standard pattern in my app an EventLink inside a zone that shuffles items between lists. I based the code on the AJAX EventLink jumpstart [1]

The two eventlinks are "add" and "remove".

>From a full page refresh if I perform an "add" on an Object instance A, then a "remove" on the same A I get the error:

     Request event 'remove' (on component mypackage/MyPage) was not handled; you must provide a matching event handler method in the component or in one of its containers.

However, if I refresh the page after the "add" and before the "remove", it works fine. If I perform the "add" and then "remove" on Object B, which was there since the page refresh, it works fine.

Here's a sample of my event handlers:

   Object onRemoveItem(Long id) {
        Item item = itemFetcher(id);
        _listOfItems.remove(item); // a Set<Item> that backs the Grid component I'm using
        _listOfItemsToAdd.add(item); // a Set<Item> for the list of addable items
	dbDelete(item);
        if (_request.isXHR()) {
            return _itemZone.getBody();
        }
        return null;
    }

    Object onAddCourseModule(Long id) {
	Item item = itemFetcher(id);
        _listOfItems.add(item);
        _listOfItemsToAdd.remove(item);
         dbAdd(item);
        if (_request.isXHR()) {
            return _itemZone.getBody();
        }
        return null;
    }



Thanks,

Casey

[1]: http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/eventlink


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


Re: Eventlink event "was not handled; you must provide a matching event handler method"

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 18 Jun 2015 16:22:35 -0300, Casey Link <ca...@outskirtslabs.com>  
wrote:

> Ugh, sorry. That was a failure on my part to correctly write the example  
> code for the email.

By the way, you haven't posted the template nor the corresponding code  
(instead of just the event handler method names), so it's hard to know  
what's happening.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Eventlink event "was not handled; you must provide a matching event handler method"

Posted by Casey Link <ca...@outskirtslabs.com>.
On Thursday, June 18, 2015 04:01:43 PM Thiago H de Paula Figueiredo wrote:
> On Thu, 18 Jun 2015 14:47:51 -0300, Casey Link <ca...@outskirtslabs.com>  
> wrote:
> 
> > Hi again,
> 
> Hi!
> 
> >      Request event 'remove' (on component mypackage/MyPage) was not  
> > handled; you must provide a matching event handler method in the  
> > component or in one of its containers.
> >    Object onRemoveItem(Long id) {
> >    Object onAddCourseModule(Long id) {
> 
> Your event handlers are not matching the event names, so they don't  
> actually handle the event. For a "remove" event, the event handler method  
> name should be "onRemove" (or any method annotated with  
> @OnEvent("remove"). The context of the EventLink must also match the event  
> handler method parameters.

Ugh, sorry. That was a failure on my part to correctly write the example code for the email.

I doubled checked, and the event handlers method names do match the EventLink names, and the contexts do match.

Like I said, the event handlers work fine on a normal page refresh, but only when I do the "add" and "remove" on the _same_ item without a page refresh in between do I experience the issue.

I'm not sure what Tapestry is doing in the background, but do I need to do something to tell Tapestry "Hey, there's a new possible item context that can be called for the event!"?

What's strange, is I can "add" on A, then "remove" on B and it works (showing that the handler exists and works!), but if I "remove" on A instead, it blows up :\ 

Casey

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


Re: Eventlink event "was not handled; you must provide a matching event handler method"

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 18 Jun 2015 14:47:51 -0300, Casey Link <ca...@outskirtslabs.com>  
wrote:

> Hi again,

Hi!

>      Request event 'remove' (on component mypackage/MyPage) was not  
> handled; you must provide a matching event handler method in the  
> component or in one of its containers.
>    Object onRemoveItem(Long id) {
>    Object onAddCourseModule(Long id) {

Your event handlers are not matching the event names, so they don't  
actually handle the event. For a "remove" event, the event handler method  
name should be "onRemove" (or any method annotated with  
@OnEvent("remove"). The context of the EventLink must also match the event  
handler method parameters.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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