Because the "action" event was not caught by it's immediate container
(the Layout component), it propagated up with a new origin: the Layout
component itself.  so onActionFromLayout() would work (because the id
'layout' will have been autoassigned by Tapestry).

The concept here is that the Layout component should limit how much of
its internal structure is exposed to the outside world: it should
ideally be a black box.

Often, a component will capture "action" events from one or more
components and trigger new events with names customized to what the
component does; here is might trigger an "edit" event, and you would
name your method onEditFromLayout().



On Tue, Mar 16, 2010 at 2:57 PM, Nicolas Bouillon <nico...@bouil.org> wrote:
> Hi,
>
> I have a simple problem. I use a component as a layout, and i want to have
> an action link that will be handled by the page that use the layout. I
> believed that the event from actionLink goes from the Layout Component to my
> page containing the component (here it is Index)
>
> Here is the source excerpt :
>
> Index.tml :
> <html t:type="layout" p:title="title">
>   ....
> </html>
>
> Layout.tml
> ....
>   <t:actionlink t:id="edit">Edit</t:actionlink>
> ...
> <div id="content">
>               <h2>${title}</h2>
>               <t:body />
> </div>
> ....
>
> Index.java
>
>   @OnEvent(component = "edit", value = EventConstants.ACTION)
>   public Object onActionFromEdit() {
>       return Edit.class;
>
>   }
>
> And I got the following error :
>
> 16/03/2010 22:51:51 ERROR
> org.apache.tapestry5.services.TapestryModule.RequestExceptionHandler -
> Processing of request failed with uncaught exception: Request event 'action'
> (on component w/Index:layout.edit) was not handled; you must provide a
> matching event handler method in the component or in one of its containers.
> org.apache.tapestry5.ioc.internal.util.TapestryException: Request event
> 'action' (on component w/Index:layout.edit) was not handled; you must
> provide a matching event handler method in the component or in one of its
> containers. [at classpath:org/bouil/tapestry/components/Layout.tml, line 59]
>   at
> org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:79)
>   at
> org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
>   at
> $ComponentEventRequestHandler_12768f52a94.handle($ComponentEventRequestHandler_12768f52a94.java)
>   at
> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
> ...
>
> What's wrong ?
>
> Thanks.
> Nicolas.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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

Reply via email to