I have xhtml
form with two buttons: "OK" and "Cancel". Both buttons calls methods of @ViewScoped
managed bean (accept() and cancel(), for example).
Moreover, xhtml
has viewParam
and some validation.
In the managedBean
state controlled by boolean variable edit
. Method cancel
turns edit
variable to false
.
The question is: how can I call cancel()
method of managedBean
without validation step? Say, I pressed "New record" button and change my mind. Now I want to cancel edit operation and when I push "Cancel" button - validation error appears, but managedBean changes state to browse (variable edit
turns to false
). The only I need - is to hide validation error message, or skip validation phase during POST request. If I use GET request, I am afraid that viewParam
get lost, because view will be updated.
Is any way to skip validation phase in JSF?
Thank you for wasting your time.