It is a very common requirement in any application to warn about changes when a user is going away from a transaction page without applying the data.
To achieve this,
uncommittedDataWarning="on" must be set on document tag.
And if the user wants to go away from the page without saving, we also need to do rollback on the data. But if the data is rolled back, uncommittedDataWarning will not work as there wont be any pending changes anymore after rollback.
So in such case, instead of doing rollback in actionlistener or action of the navigation button, rollback should be included in adfc-config after navigating away from page. (i.e after user clicks on OK button of warning popup).
Steps to do this :
1. Right click on adfc-config , Insert inside ADF Task Flow –> ADF Task Flow –> Method Call.
2. Give some unique Activity Id
3. select from expression builder, the rollback binding from ur page definition
4. Give an outcome to navigate to destination.
5. Now add a control flow between source page and this method call , and another control flow from this method call to destination page.
This way rollback is achieved before navigating to destination page and after the warning message.