This week's book giveaway is in the Testing forum. We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line! See this thread for details.
I need some help in handling application errors. I have a registration module in my application. Flow is something like this:
Register.xhtml calls RegistrationBean's register action method. This method calls a Helper class for inserting user records in the database.
Now if user entered record already exist in the database, unique constraint error I get from the oracle. This in turn throws org.hibernate.exception.ConstraintViolationException.
Now what I did so far is I caught this exception in my RegistrationHelper class, retrieved the facescontext, added a message in that and returns string "failure". Then my RegistrationBean class simply forwards to the configured failure page.
My question: Is it the right approach in handling exception using JSF?