• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to handle ejb exception in jsp  RSS feed

 
sitaram irrinki
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When EJB throws exceptions. how can handle this exceptions in jsp
 
Shibu Raj
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sitaram irrinki,

The question is more of general nature and so I wont be able to give you a very specific answer to the problem you are facing. But the best way to handle exceptions generated by your EJB's is to encapsulate the exceptions generated by EJB's in to your own application exceptions and throw that to JSP. Once you have the exceptions in EJB you can handle as you like. The good thing about this process is you can encapsulate the EJB error messages in to your own custom error message, which make more sense to your application users.

Note : In the Ed Romans EJB book there is an example also for this, in which he generates the AccountException in the EJB Layer.

Hope that example will help you to solve the problem.

Thanks
Shibu
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!