Best bet here is definitely going to be a parameter.
Or to go ahead and put the listener in the component... :) Can the
listener be generalized? If so, put it in the component, and you'll save
yourself time and effort later (and debugging time, and... :)
But that having been said...
<parameter name="listener" direction="auto"
type="org.apache.tapestry.IActionListener" required="yes"/>
(note, I'm a little fuzzy on the type... you could do a number of things:
don't define it, and just let the default of "object" work, or else look
at the type on direct link.)

Then you'll want to do:

<component id="someLink" type="DirectLink">
  <inherited-binding name="listener" parameter-name="listener"/>
  ...
</component>

in the .jwc spec. You don't /have/ to make it inherited, but, in this
situation, it's probably best to make it inherited.

Robert

>
 Yes, it works. Thanks a ton.
>
> I have another DirectLink component in the spec. But I just can't seem
> to link it to the page containing the component. The exception report
> indicates that it can't find the listener in the component. I know it
> is not there because that's not what I want it to be; it should go and
> look for the listener created in the page that called the component.
>
> Would you show me how to do it again?
>
>
> waimun
>
> On 8/31/05, Robert Zeigler <[EMAIL PROTECTED]> wrote:
>  > So, your component needs to render something within an insert, right?
>  > But the value to render isn't known by the component; rather, it's
> some
>  > property of the page. So, in your component, you'd do (tapestry
> 3.0.3):
>  >
>  > <parameter name="renderString" direction="in" required="yes"
>  > type="java.lang.String"/>
>  >
>  > In your component template you'd do:
>  > <span jwcid="@Insert" value="ognl:renderString"/>
>  >
>  > And in your page you'd do something like:
>  >
>  > <span jwcid="@MyCustomComponent" renderString="ognl:pageProperty"/>
>  >
>  > Where pageProperty is the property name to render on the page, and
>  > renderString can be whatever name makes sense for your component.
>  >
>  > Robert
>  >
>  > Waimun Yeow wrote:
>  > > I tried the page.<property> but did not work. Would you show me how
> you
>  > > would accomplish it via component parameter?
>  > >
>  > > Tks.
>  > >
>  > > waimun
>  > >
>  > > On 8/30/05, Robert Zeigler <[EMAIL PROTECTED]> wrote:
>  > >> Hm. Well, this really sounds like a good candidate for a
>  > >> component-parameter. :)
>  > >> But... as long as you can guarantee that the property will exist...
>  > >> you can do something like:
>  > >>
>  > >> ognl:page.<property>
>  > >>
>  > >> getPage() returns the containing page.  Note that if you use
> complex
>  > >> block/render-block schemes (where the block is placed on one page
> but
>  > >> contained within a different page), this can lead to unexpected
> results
>  > >> (getPage() will return the page which contains the block, and NOT
> the
>  > >> page currently doing the rendering).  Again... /generally/
> speaking,
>  > >> you'd be better off making this a component parameter.
>  > >>
>  > >> Robert
>  > >>
>  > >> Waimun Yeow wrote:
>  > >> > Hi folks,
>  > >> >
>  > >> > I have a component specification .jwc with a component of type
> Insert.
>  > >> > The binding expression needs to reference to a page property
> value that
>  > >> > called it. For example, by random, if page A include this
> component,
>  > >> > then the Insert component will need to read page A property via
> ognl
>  > >> > thru binding expression attribute.
>  > >> >
>  > >> > Any hints? Thanks a lot.
>  > >> >
>  > >> > --
>  > >> > waimun
>  > >> >
>  > >> >
>  > >> >
> ---------------------------------------------------------------------
>  > >> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
>  > >> > For additional commands, e-mail:
> [EMAIL PROTECTED]
>  > >>
>  > >>
>  > >>
> ---------------------------------------------------------------------
>  > >> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
>  > >> For additional commands, e-mail:
> [EMAIL PROTECTED]
>  > >>
>  > >>
>  > >
>  > >
>  > >
> ---------------------------------------------------------------------
>  > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > > For additional commands, e-mail:
> [EMAIL PROTECTED]
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to