Hi,

I've seen some examples on how to generate a DirectLink programmatic but
so far, I couldn't get it to work. Especially because I need it to update
a component via ajax.

Quick overview: I parse external static html text with fake links and
replace those links with the correct versions. One of them is a [Buy] button and it needs to call a listener to add the item to the database and then it
refreshes the view on the page via ajax.

On my normal Tapestry pages, this looks like:

<component id="buy_link" type="DirectLink">
  <binding name="listener" value="listener:doAddToBasket"/>
<binding name="parameters" value="new java.lang.Object[] { item_id, 1, '' }"/>
  <binding name="updateComponents" value="{'basket_container'}"/>
  <binding name="async" value="true"/>
</component>

and this works fine. Now, on my "content" page which will read in a specific html page via a given name, I do a search/replace sweep and there, I need to
do the same (the basket component is in my Border).

What I have done is to have a fake_buy component similar to the one above in my content page and a property 'item_id' which is referred by fake_by. I was
able to do this:

setItem_id(linkParam);
DirectLink fakeBuy = (DirectLink)getComponent("fake_buy");
ILink fakeBuyLink = fakeBuy.getLink(getPage().getRequestCycle());
link = fakeBuyLink.getURL();

But I am not sure if this is the right way to do it because I fear side
effects.

Andreas Pardeike

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

Reply via email to