You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ael <al...@dash.com.ph> on 2010/09/13 11:27:18 UTC
T5 Eventlink Query
Hello Everyone
I have two template. ex. template 1 & template 2.
Then in template 2 i have an eventlink.
My question is how can i link the eventlink from page 1?
Example i will click a link from page 1 then it will trigger the eventlink
on page 2.
Any ideas :) ty...
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Eventlink-Query-tp2837470p2837470.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 Eventlink Query
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 13 Sep 2010 06:55:31 -0300, Elin <po...@gmail.com> wrote:
> Im just starting with tapestry but, why would you like to do that?
Do what?
> As far as i know, the eventlink is very similar to the actionlink, and
> its usually
> used for some kind of ajax request.
I disagree. Both components are used for both AJAX and non-AJAX events.
> Could you explain a bit more what are
> you trying to do with those 2 templates?
They're not templates, they're components.
ActionLink exists since Tapestry exists and always trigger the same event
("action"). EventLink was created later and allows you to define the name
of the event to be triggered. There's absolutely no other difference
between them. I consider ActionLink deprecated at this point.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 Eventlink Query
Posted by Elin <po...@gmail.com>.
Im just starting with tapestry but, why would you like to do that? As far as
i know, the eventlink is very similar to the actionlink, and its usually
used for some kind of ajax request. Could you explain a bit more what are
you trying to do with those 2 templates?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Eventlink-Query-tp2837470p2837503.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 Eventlink Query
Posted by ael <al...@dash.com.ph>.
Hi Thiago,
In my template 2 i can display many pages ex. template 2 display test1 or
test2 so on... using an eventlink then link parameters plus if else
component.
Then using link parameter i can make a link from template 1 pointing to
template 2 that will display test1 or test2.
But in actionlink using zone & block i cannot do that kind of event that
will link my template 1 pointing to template 2 that will display test1 or
test2.
I like to do it in AJAX because it is fast.
But currently i cannot hypherlink the actionlink from different pages.
Ex. code - Eventlink
template 1 class
@Inject
private Request request;
@BeginRender
public void beginRender(MarkupWriter writer)
[a href='" + request.getContextPath() + "/template2?cid=a01¶m=pm'][/a]
template 2
# PM
<t:if test="temppm">
test1
<p:else>
test2
</p:else>
</t:if>
template 2 - class
@Property
private String param;
@Property
private String cid;
@Property
private boolean temppm;
@Inject
private PageRenderLinkSource pageRenderLinkSource;
@Inject
private Request request;
@InjectPage
private aboutus abs;
private Link link;
// Request Parameters
public Link set(String param, String cid) {
link = pageRenderLinkSource.createPageRenderLink(this.getClass());
if (param != null && cid != null) {
link.addParameter("param", param);
link.addParameter("cid", cid);
}
return link;
}
// Page Load
void onActivate() {
param = request.getParameter("param");
if(param.trim().equals("pm")){
temppm = true;
}
else
temppm = false;
}
Object onPM() {
link = abs.set("pm","a01");
return link;
}
As you see i can link my template 1 to template 2 that will display test1 or
test 2.
But i cannot do it in actionlink its quite hard. ^_^
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Eventlink-Query-tp2837470p2838417.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 Eventlink Query
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 13 Sep 2010 06:27:18 -0300, ael <al...@dash.com.ph> wrote:
> Hello Everyone
Hi!
> I have two template. ex. template 1 & template 2.
> Then in template 2 i have an eventlink.
> My question is how can i link the eventlink from page 1?
You should avoid triggering events from one page to another one. Use an
event in page 1 then redirect to page 2:
<a href="#" t:type="EventLink" t:event="yourEventName">...</a>
@InjectPage
private Page2 page2;
Object onYourEventName() {
// invoke methods in page2;
return page2;
}
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org