When EJB throws exceptions. how can handle this exceptions in jsp
posted 12 years ago
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.