You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bobby rullo <br...@alexanderinteractive.com> on 2005/04/22 21:14:40 UTC

Problem passing A listener across several components

Hi everyone,

I have a tricky binding problem here. It is a bit long winded, so please bear
with me. I have component called EntityList which takes a parameter called 
viewListener as like so:

    <parameter name="viewListener" 
               direction="in" 
               required="no" 
               type="org.apache.tapestry.IActionListener" >
       <description>
           This is the listener that should be triggered when clicking the 
           link for viewing a particular item
       </description>
    </parameter>

and then I use it in a direct link like so:

    <component id="directView" type="DirectLink">
        <binding name="listener" expression="viewListener"/>
        <binding name="parameters" expression="currentItem.id"/>
    </component>

I have many pages which use entity list, passing in a listener from the page to
the viewListener binding of the EntityList.

However I am having problems when I need to pass the listener from a page to a
component and finally to the EntityList. In this case I have a Customer page
which passes the listener to the PartyList component. The PartyList's param spec
is as follows:

    <parameter name="viewListener" 
               direction="in" 
               required="yes" 
               type="org.apache.tapestry.IActionListener" />

And the PartyList in turn passes that listener to its EntityList:

    <component id="entityList" type="EntityList">
         ...
         <binding name="viewListener" expression="viewListener"/> 
         ...
    </component>

But when the directView link is clicked, I get the following:

   Value for parameter 'listener' in component 
   owner/customerList/partyList.entityList.$DirectLink is null, 
   and a non-null value is required.

Now I know for a fact that the listener wasn't null before, because I did an
@Insert on "ognl:viewListener" to make sure. 

The question is why is my viewListener null when I do a directView?

Thanks in advance for your help,

Bobby





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


Re: Problem passing A listener across several components: FIXED

Posted by bobby rullo <br...@alexanderinteractive.com>.
I solved that problem. As the documentation states:

"Warning

If your component has any listener methods that need to access a parameter
value, then you can't use direction in (or direction form). Listener methods are
invoked outside of the page rendering process, when value stored in the
connected parameter property is not set. You must use direction auto or custom
in such cases. "

That pretty much says it all.

Thanks again,

Bobby


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