You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Markus Kramer <to...@googlemail.com> on 2007/04/19 00:22:11 UTC

Invoke a page listener from a component template

Hi everyone,
I've got a DirectLink in a component template. But when this link is
clicked I don't want to call a listener method of that component, but
a listener method of the page that contains the component.
I tried it like this, but it didn't work:

<a href="#" jwcid="@DirectLink" listener="listener:page.doClick">xyz</a>

The reason is that I need access to an application state object.

Alternatively I'm thinking about to have my component write out the
HTML code directly, and not to use a template. The component could
then print a hyperlink without using the DirectLink component. But I
don't know how such a 'static' link might look like, since Tapestry's
URLs don't have a parameter which tells it what listener method is
supposed to be invoked.

Any ideas would be appreciated!

 - Markus

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


Re: Invoke a page listener from a component template

Posted by Markus Kramer <to...@googlemail.com>.
Great!
ognl:page.listeners.doClick did the job. I wasn't aware that you could
also use a ognl expression instead of a listener expression.

Injecting an ASO into a component worked as well. Somehow I thought
this wasn't possible.
Thanks for the quick help.

Bye
Markus



2007/4/19, Ben Dotte <bd...@widen.com>:
> Hi Markus,
>
> Is there any reason you can't inject the ASO into your component class?
>
> @InjectState("nameofASO")
> public abstract MyASO getMyASO();
>
> Otherwise if you really want to access the listener on the page I wonder
> if listener:page.listeners.doClick would work instead.
>
> HTH
>
> Ben
>
> -----Original Message-----
> From: Markus Kramer [mailto:tomatonius@googlemail.com]
> Sent: Wednesday, April 18, 2007 5:22 PM
> To: users@tapestry.apache.org
> Subject: Invoke a page listener from a component template
>
> Hi everyone,
> I've got a DirectLink in a component template. But when this link is
> clicked I don't want to call a listener method of that component, but
> a listener method of the page that contains the component.
> I tried it like this, but it didn't work:
>
> <a href="#" jwcid="@DirectLink" listener="listener:page.doClick">xyz</a>
>
> The reason is that I need access to an application state object.
>
> Alternatively I'm thinking about to have my component write out the
> HTML code directly, and not to use a template. The component could
> then print a hyperlink without using the DirectLink component. But I
> don't know how such a 'static' link might look like, since Tapestry's
> URLs don't have a parameter which tells it what listener method is
> supposed to be invoked.
>
> Any ideas would be appreciated!
>
>  - Markus
>
> ---------------------------------------------------------------------
> 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


Re: Invoke a page listener from a component template

Posted by Andreas Andreou <an...@di.uoa.gr>.
Also, a component can always accept a listener as a parameter!

In this way, users of that component can specify their own action to be
invoked
when the component does something

On 4/19/07, Ben Dotte <bd...@widen.com> wrote:
>
> Sorry, I meant ognl:page.listeners.doClick
>
> -----Original Message-----
> From: Ben Dotte [mailto:bdotte@widen.com]
> Sent: Wednesday, April 18, 2007 5:28 PM
> To: Tapestry users
> Subject: RE: Invoke a page listener from a component template
>
> Hi Markus,
>
> Is there any reason you can't inject the ASO into your component class?
>
> @InjectState("nameofASO")
> public abstract MyASO getMyASO();
>
> Otherwise if you really want to access the listener on the page I wonder
> if listener:page.listeners.doClick would work instead.
>
> HTH
>
> Ben
>
> -----Original Message-----
> From: Markus Kramer [mailto:tomatonius@googlemail.com]
> Sent: Wednesday, April 18, 2007 5:22 PM
> To: users@tapestry.apache.org
> Subject: Invoke a page listener from a component template
>
> Hi everyone,
> I've got a DirectLink in a component template. But when this link is
> clicked I don't want to call a listener method of that component, but
> a listener method of the page that contains the component.
> I tried it like this, but it didn't work:
>
> <a href="#" jwcid="@DirectLink" listener="listener:page.doClick">xyz</a>
>
> The reason is that I need access to an application state object.
>
> Alternatively I'm thinking about to have my component write out the
> HTML code directly, and not to use a template. The component could
> then print a hyperlink without using the DirectLink component. But I
> don't know how such a 'static' link might look like, since Tapestry's
> URLs don't have a parameter which tells it what listener method is
> supposed to be invoked.
>
> Any ideas would be appreciated!
>
> - Markus
>
> ---------------------------------------------------------------------
> 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
>
>
>


-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

RE: Invoke a page listener from a component template

Posted by Ben Dotte <bd...@widen.com>.
Sorry, I meant ognl:page.listeners.doClick

-----Original Message-----
From: Ben Dotte [mailto:bdotte@widen.com] 
Sent: Wednesday, April 18, 2007 5:28 PM
To: Tapestry users
Subject: RE: Invoke a page listener from a component template

Hi Markus,

Is there any reason you can't inject the ASO into your component class?

@InjectState("nameofASO")
public abstract MyASO getMyASO();

Otherwise if you really want to access the listener on the page I wonder
if listener:page.listeners.doClick would work instead.

HTH

Ben

-----Original Message-----
From: Markus Kramer [mailto:tomatonius@googlemail.com] 
Sent: Wednesday, April 18, 2007 5:22 PM
To: users@tapestry.apache.org
Subject: Invoke a page listener from a component template

Hi everyone,
I've got a DirectLink in a component template. But when this link is
clicked I don't want to call a listener method of that component, but
a listener method of the page that contains the component.
I tried it like this, but it didn't work:

<a href="#" jwcid="@DirectLink" listener="listener:page.doClick">xyz</a>

The reason is that I need access to an application state object.

Alternatively I'm thinking about to have my component write out the
HTML code directly, and not to use a template. The component could
then print a hyperlink without using the DirectLink component. But I
don't know how such a 'static' link might look like, since Tapestry's
URLs don't have a parameter which tells it what listener method is
supposed to be invoked.

Any ideas would be appreciated!

 - Markus

---------------------------------------------------------------------
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


RE: Invoke a page listener from a component template

Posted by Ben Dotte <bd...@widen.com>.
Hi Markus,

Is there any reason you can't inject the ASO into your component class?

@InjectState("nameofASO")
public abstract MyASO getMyASO();

Otherwise if you really want to access the listener on the page I wonder
if listener:page.listeners.doClick would work instead.

HTH

Ben

-----Original Message-----
From: Markus Kramer [mailto:tomatonius@googlemail.com] 
Sent: Wednesday, April 18, 2007 5:22 PM
To: users@tapestry.apache.org
Subject: Invoke a page listener from a component template

Hi everyone,
I've got a DirectLink in a component template. But when this link is
clicked I don't want to call a listener method of that component, but
a listener method of the page that contains the component.
I tried it like this, but it didn't work:

<a href="#" jwcid="@DirectLink" listener="listener:page.doClick">xyz</a>

The reason is that I need access to an application state object.

Alternatively I'm thinking about to have my component write out the
HTML code directly, and not to use a template. The component could
then print a hyperlink without using the DirectLink component. But I
don't know how such a 'static' link might look like, since Tapestry's
URLs don't have a parameter which tells it what listener method is
supposed to be invoked.

Any ideas would be appreciated!

 - Markus

---------------------------------------------------------------------
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