Sounds reasonable to me, is there a JIRA issue somewhere that I can vote on? :D

-Filip

On 2008-04-13 06:15, Geoff Callender wrote:
It's great that we have these workarounds to prevent leaving ValidationTrackerImpl objects littered throughout the session, but I'm having trouble understanding how it came to this. After all, I can't think of a single case where I'd want a form's validation errors to be retained after the form has been displayed. So why not make "flash" persistence the default for Form's ValidationTracker so we can all forget about it?

Geoff

On 28/02/2008, at 11:43 PM, Robert Zeigler wrote:

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]



---------------------------------------------------------------------
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