This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a page that displays a form and when it's submitted it displays a PDF report. The user might back up multiple times to re-submit this form to see the report with different parameters. If the user makes a mistake by entering invalid data the page fails validation and displays errors. If the user then corrects those errors and re-submits the form, the report will run. But if they back up after submitting the form those old errors from the previous submission are still displayed. I am looking for a way to clear the errors in the <h:messages> tags from the page when the user backs up. Is there any way to do this?
As an example here's a description of what happens:
User visits url for first time
User submits form with invalid data
Validation fails and re-displays page populating <h:message> tags
You should discourage the use of the back button and instead allow them to go back using a commandLink or button on the page. That forces the app to cycle through the JSF life cycle and clear the message queue.