You can also provide the tracker parameter to form, which looks almost the same as extending form, except that you don't have to extend form. :)

@Component(parameters={"tracker=customTracker"})
private Form form;

@Persist("flash")
private ValidationTracker customTracker;

public ValidationTracker getCustomTracker() {
        if (customTracker == null) {
                customTracker = new ValidationTrackerImpl();
         }
         return customTracker;
}

Robert

On Feb 28, 2008, at 2/283:39 AM , Christian Köberl wrote:


Q: Why does the form show old data and old errors not the newly set object?
(see:
http://www.nabble.com/-T5--Why-is-default-ValidationTracker-in-Form-marked-Persist-not-Persist%28%22flash%22%29-td11981083.html)

A1: Write your own form extending the tapestry default form:
public class Form extends org.apache.tapestry.corelib.components.Form
{
        @Persist("flash")
        private ValidationTracker defaultTracker;

        @Override
   public ValidationTracker getDefaultTracker()
        {
                if (defaultTracker == null)
                        defaultTracker = new ValidationTrackerImpl();

                return defaultTracker;
        }

        @Override
   public void setDefaultTracker(ValidationTracker defaultTracker)
        {
                this.defaultTracker = defaultTracker;
        }

}

A2: use @Meta("tapestry.persistence-strategy=flash") on your page to control the default persistence of components below it. This will result in *all*
components having a default flash persistence.

@Howard: any better idea?

--
Chris
--
View this message in context: 
http://www.nabble.com/Writing-an-FAQ-for-Tapestry-5-tp15719185p15732836.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


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

Reply via email to