Here is how I tend to handle it:

@Property @Persist("flash")
    private String commitMessage;

public void onPrepare(){
        if(commitMessage == null)
            commitMessage = "";
    }

void onSuccessFromUserForm(){
        try{
            //update call
commitMessage = "User " + user.getId() + " was successfully updated!";
        }catch(Exception e){
            commitMessage = "Failed to update user " + user.getId();
        }
   }


then in the tml I just have ${commitMessage} where I want it to display. If there is a reason this won't work, you could consider making the boolean false at a later render phase like afterRender I'd imagine.

-Rich

On 09/15/2010 12:38 PM, Tim Koop wrote:
 Hi everyone.  I hope this is a quick and easy question.

I want to show a "Form successfully submitted" message, so in my Page object I have this:

    @Persist
    @Property
    private boolean showSuccess;

Then in my onSuccess method I have this:

    private void onSuccess() {
        ...
        showSuccess = true;
    }

My question is this: where do I set showSuccess to be false? If the user ever comes back to the page again, the value will still be true but it should be false. If I set it false in pageLoaded or pageAttached, it will always be false because that happens after onSuccess (on the reload).

Thanks.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to