Not sure if I'm understanding your sequence, but I don't see an AJAX request there. Tapestry can return zone(s) in response to an AJAX request (ie. XHR). Do these help?
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/eventlink http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/form Geoff On 25 March 2014 23:41, Davide Vecchi <d...@amc.dk> wrote: > Sorry for the double post. After I posted the first one I realized I had > unsubscribed from the mailing list some time ago, so I subscribed and sent > the question again. I thought the one I had sent while unsubscribed > wouldn't show up (it hadn't at that time). My apologies. > > -----Original Message----- > Sent: Tuesday, March 25, 2014 12:27 > To: users@tapestry.apache.org > Subject: Updating a zone from a property method > > I have a zone to show possible errors that might occur in a get* method > called by Tapestry during page rendering to retrieve the value for a > property (String myValue in the example below). > > So in this getMyValue() method I set the error message into another > property (@Property String errorMessage) and I call addRender to update the > template zone errorZone, where ${errorMessage} is placed. > > My problem is that this call to addRender has no effect: the errorMessage > is not shown. But if I just reload the page it is shown. > > Below is a testable example. I'm trying to find out what's the right way > to update a zone from a get* method called by Tapestry during page > rendering. > > ##################################### > TestRender.tml: > ##################################### > > > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"> > > <t:zone id="errorZone" t:id="errorZone"> > > <t:if t:test="isError"> > > <div style="background-color: > yellow;">${errorMessage}</div> > > </t:if> > > </t:zone> > > myValue: ${myValue} > > </html> > > > ##################################### > TestRender.java: > ##################################### > > import java.util.Date; > > import org.apache.tapestry5.PersistenceConstants; > import org.apache.tapestry5.annotations.InjectComponent; > import org.apache.tapestry5.annotations.Persist; > import org.apache.tapestry5.annotations.Property; > import org.apache.tapestry5.corelib.components.Zone; > import org.apache.tapestry5.ioc.annotations.Inject; > import org.apache.tapestry5.services.ajax.AjaxResponseRenderer; > > public class TestRender > { > > @Persist(PersistenceConstants.FLASH) > @Property > private boolean isError; > > @Persist(PersistenceConstants.FLASH) > @Property > private String errorMessage; > > @InjectComponent > @Property > private Zone errorZone; > > @Inject > private AjaxResponseRenderer ajaxResponseRenderer; > > @Persist > private String myValue; > > public void setupRender() > { > System.out.println(new Date() + " setupRender() was > executed. It does nothing at all."); > } > > public String getMyValue() > { > if (this.myValue == null) > { > System.out.println(new Date() + " myValue was null, > so getMyValue() is setting it..."); > > this.myValue = "My value at " + new Date(); > > this.isError = true; > this.errorMessage = "Let's say there was an error so > I want to show this error message."; > > this.ajaxResponseRenderer.addRender(this.errorZone); > > /* I expected this addRender to cause the error > message to be shown right away > without the need to reload the page, but this is > not the case. */ > > System.out.println(new Date() + " getMyValue() has > just called addRender."); > } > else > { > System.out.println(new Date() + " myValue was NOT > null, so getMyValue() did nothing at all."); > } > return this.myValue; > } > } > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >