You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Lewis <ch...@bellsouth.net> on 2007/09/21 07:58:16 UTC
t5: ActionLink-ing to a different page.
I'm working on a simple component that you can pass "title" and
"contents" parameters to. The result is basically a decorated box
containing links - this can be used to create simple "control" boxes,
etc. My problem is that the links need to actions links to other
component or page classes, so the component or the embedding page
doesn't need to handle the event. For example, say I have a handful of
pages in my app (Logout, NewUpload, NewComment), and I want my component
to be able to create links to these pages that would trigger an action.
I don't see how this is possible with actionlink. It seems that
actionlinks always fire an action in the component or page class, but
cannot be used to trigger actions in other pages or components! Am I
misunderstanding or overlooking something?
Thanks,
chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: t5: ActionLink-ing to a different page.
Posted by Nick Westgate <ni...@key-planning.co.jp>.
To be more precise Francois is suggesting you use PageLinks with a
context and handle the "actions" in the destination page onActivate.
If that really doesn't fit your use case I suppose another avenue to
explore would be to expose the pages' resources:
(This could go in a base class.)
@Inject
private ComponentResources resources;
...
public ComponentResources getResources()
{
return resources;
}
and then manually construct links getting the URL's in your component
by injecting the pages and using their resources. Something like:
String getSomePageSomeActionUrl()
{
_somePage.getResources().createActionLink("someAction", false, new Object[0]).toURI();
}
No time to play with this sorry, but it might be worth a crack.
Cheers,
Nick.
Francois Armand wrote:
> Chris Lewis wrote:
>> [...] For example, say I have a handful of pages in my app (Logout,
>> NewUpload, NewComment), and I want my component to be able to create
>> links to these pages that would trigger an action.
>> I don't see how this is possible with actionlink. It seems that
>> actionlinks always fire an action in the component or page class, but
>> cannot be used to trigger actions in other pages or components! Am I
>> misunderstanding or overlooking something?
> Well, I think that the behavior of action link is ok : if you want to
> fire an action on the target page, there is no need to have a special
> action handler in the target, you simply can pass a parameter into the
> context of the link, and analyze it on the target, when onActivate occurs.
> For more information, see :
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: t5: ActionLink-ing to a different page.
Posted by Francois Armand <fa...@linagora.com>.
Chris Lewis wrote:
> [...] For example, say I have a handful of pages in my app (Logout,
> NewUpload, NewComment), and I want my component to be able to create
> links to these pages that would trigger an action.
> I don't see how this is possible with actionlink. It seems that
> actionlinks always fire an action in the component or page class, but
> cannot be used to trigger actions in other pages or components! Am I
> misunderstanding or overlooking something?
Well, I think that the behavior of action link is ok : if you want to
fire an action on the target page, there is no need to have a special
action handler in the target, you simply can pass a parameter into the
context of the link, and analyze it on the target, when onActivate occurs.
For more information, see :
http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
--
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
InterLDAP - http://interldap.org
FederID - http://www.federid.org/
Open Source identities management and federation
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org