I need ideas to solve next situation.
I have a commandButton with ajax that invokes a listener with a boolean method, something like this:
<h:commandButton value="Add">
<f:ajax listener="#{shoppingCartBean.makeReservation(devicesBean.device)}" />
</h:commandButton>
If the listener returns true, its because device is correctly reserved, everything works fine and I need to redirect to another url with a location.href js function.
If the listener returns false, I need that a js alert will be shown with a "Sorry, no device stock bla bla bla".
How can I manage that? Thx in advance.