Sometimes the problem with validators is that you can’t send a cancel button from within a form, because the validator stops processing it. In this case it is usefull to set the button on immediate=”true”, but then the problem might be that the view ist not correctly cleared. To force clearing the view, it is important to navigate with an outcome other than null (”").
<h:commandButton immediate="true" actionListener="#{bean.discardEditing}" value="#{msg.action_cancel}" />
In the example “bean.discardEditing” does some cleanup and returns a navigation outcome to navigate to the same screen again, e.g. “revertToEdit”.
- MyFaces Wiki on ClearingInputComponents (works with richfaces, too)
There are other options described there, but the non-null-navigation is the most lightweight, I think. - And a bit background info on the immediate attribute