How to display confirmation message in Tapestry5?

I am developing a website as part of my project last year and I want to display a message confirming that an email has been sent.

I know how to display user error messages in the form, that is, you cannot go further until the following errors are fixed: the username is unknown!

I want to display a message that says: your message has been sent! after sending the email. I was told that I should display this message through a flash.

I am not sure how to do this, any help would be greatly appreciated.

+3
source share
2 answers

, , :

<span t:type="If" t:test="messageSent">Your message was sent.</span>

:

@Persist(PersistenceConstants.FLASH)
private boolean messageSent;


public boolean isMessageSent() {
    return this.messageSent;
}

@OnEvent(EventConstants.SUCCESS)
void onSendMessage() {
    ...
    this.messageSent = true;
}

, , - AJAX, .

+2

Tapestry 5.3 "".

:

<t:alerts />

:

@Inject
private AlertManager alertManager;

@OnEvent(EventConstants.SUCCESS)
void onSendMessage() {
     ...
     this.alertManager.success("Your message was sent.");
}

Jumpstart . http://jumpstart.doublenegative.com.au/jumpstart7/examples/component/alerts

0

Source: https://habr.com/ru/post/1744921/


All Articles