Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF Exception handling  RSS feed

Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!