I'm using jsf 2
and primefaces 4
.
I have gone through the following link Click Here and used in my application, actionListener
for executing validation logic as well as business logic .
action
attribute for redirecting.
So for it is fine but if i get any validation errors, i must show them on the same page. This means it is ajax response.
I tested this case, even there are validation errors, it is redirecting to another page as mentioned in action
attribute
if no validation errors, it should be redirected to another page, this is not ajax response in this case.
So how to handle both the situations ?
Any help is highly appreciated
I have implemented this by instructions given in comments by @Hatem Alimam and @Jaqen H'ghar .
solution:
I used action
to execute validations and business logic and redirecting based on success
or errors
.
After redirecting to another page, showing notification using flash scope
is useful a lot.
FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.