I have a bunch of Seam form pages; each has a command button that calls a sendEmail() method in a custom utility class. The method looks like this:
public String sendEmail(String mailFile) throws SMTPSendFailedException {
status = "Processing email now...";
renderer.render(mailFile);
status = "Email sent successfully.";
renderer = null;
return "/index.xhtml";
}
The button looks like this:
<a4j:commandButton action="#{utilities.sendEmail('/form2/mail.xhtml')}" />
The sendEmail() method returns the index.xhtml page for the form to redirect to. The index page also has the list of all the forms and is where users arrive when they first get started with the app.
I'd like to display a message of success or failure when the user has submitted the email, or if the user got to the page through a link, then don't show anything. Would I use Seam page parameters to tell index.xhtml that it's received a message?
Your help is much appreciated. Thanks.